You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级pip后无法安装dns模块,运行Electrum提示缺少该模块

Solution to "No module named 'dns'" Error in Electrum

I see exactly what's going on here—you're trying to install a package named dns, but the correct PyPI package for DNS functionality that Electrum relies on is called dnspython. That's why pip install dns is failing to find any matching distributions.

Step-by-Step Fix

  1. Install the correct package using Electrum's local pip to ensure it's installed in the right environment (since Electrum uses a self-contained setup):
    ~/electrum/pip install dnspython
    
  2. Verify the installation by launching Electrum again:
    ~/electrum/python electrum
    

Why This Error Occurs

When you ran ~/electrum/python electrum, you got:

Error: No module named 'dns'. Try 'sudo pip install '

The <module-name> here is a placeholder, but the actual package name isn't dns—PyPI doesn't host a package under that exact name. That's why your attempt to install it resulted in:

Collecting dns
Could not find a version that satisfies the requirement dns (from versions: )
No matching distribution found for dns

Additional Context

Based on your git log, you're running the latest master branch of Electrum (commit c8e67e2bd07efe042703bc1368d499c5e555f854), so this fix should apply directly. If you still encounter issues, double-check that you're using the pip and python executables located in your ~/electrum directory—system-wide package installations won't affect Electrum's isolated environment.

内容的提问来源于stack exchange,提问作者quantumpotato

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:34:23