Windows 10工作电脑无法安装Python Pylint问题求助
问题分析与解决步骤
从你的pip执行日志来看,核心错误是NewConnectionError: [Errno 11001] getaddrinfo failed,这表明DNS解析失败,无法连接到PyPI服务器,属于网络层面的问题,和pip版本、Pylint包本身无关。
以下是具体排查和解决方法:
验证DNS解析:
打开命令提示符,执行nslookup pypi.org,如果返回"找不到pypi.org的服务器",说明你的DNS设置无法解析PyPI域名。可以尝试手动指定公共DNS(如8.8.8.8),或者联系公司IT确认网络DNS配置。配置代理(工作环境必备):
工作电脑通常需要通过代理访问外网,给pip添加代理设置:- 临时安装时指定代理:
pip install pylint --proxy=http://你的代理服务器地址:端口 - 永久配置pip代理:
在Windows系统中,创建%APPDATA%\pip\pip.ini文件,写入以下内容(替换为你的代理信息):[global] proxy = http://proxy.example.com:8080
- 临时安装时指定代理:
切换PyPI镜像源:
如果公司网络允许访问国内镜像,可使用国内镜像源绕过DNS或网络限制:pip install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple检查防火墙/安全软件:
公司防火墙或本地杀毒软件可能拦截了pip的HTTPS请求(端口443),联系IT部门确认是否放行PyPI相关域名(pypi.org、files.pythonhosted.org等)的网络访问。
附你的执行日志:
C:\Python312>pip -V pip 23.2.1 from C:\Python312\Lib\site-packages\pip (python 3.12) C:\Python312>pip install pylint WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000025AB8013A40>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pylint/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000025AB7D58FB0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pylint/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000025AB8069B80>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pylint/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000025AB8069CD0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pylint/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000025AB8069E80>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pylint/ ERROR: Could not find a version that satisfies the requirement pylint (from versions: none) ERROR: No matching distribution found for pylint C:\Python312>
内容的提问来源于stack exchange,提问作者talkenpb
相关产品推荐
相关产品推荐

