python pip install 好像有上网源问题

问题描述 投票:0回答:2

我在可以访问互联网的机器上使用 Python 3.7.2。任何软件包的安装都会给我带来以下问题:

M:>\pip install matplotlib 

Collecting matplotlib   Retrying
 (Retry(total=4, connect=None, read=None, redirect=None, status=None))
 after connection broken by
 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
 object at 0x04127270>: Failed to establish a new connection: [Errno
 11001] getaddrinfo failed')': /simple/matplotlib/   Retrying
 (Retry(total=3, connect=None, read=None, redirect=None, status=None))
 after connection broken by
 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
 object at 0x04127AD0>: Failed to establish a new connection: [Errno
 11001] getaddrinfo failed')': /simple/matplotlib/   Retrying
 (Retry(total=2, connect=None, read=None, redirect=None, status=None))
 after connection broken by
 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
 object at 0x04127AB0>: Failed to establish a new connection: [Errno
 11001] getaddrinfo failed')': /simple/matplotlib/   Retrying
 (Retry(total=1, connect=None, read=None, redirect=None, status=None))
 after connection broken by
 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
 object at 0x0414B390>: Failed to establish a new connection: [Errno
 11001] getaddrinfo failed')': /simple/matplotlib/   Retrying
 (Retry(total=0, connect=None, read=None, redirect=None, status=None))
 after connection broken by
 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
 object at 0x0414B210>: Failed to establish a new connection: [Errno
 11001] getaddrinfo failed')': /simple/matplotlib/   Could not find a
 version that satisfies the requirement matplotlib (from versions: ) No
 matching distribution found for matplotlib

A.)如何解决这个问题?

A.1) 某些机构似乎阻止了特定的访问。如何切换下载网址?

A.2) 是否有一些替代镜像以及如何访问它们?

提前致谢!

python pip
2个回答
1
投票

将名称服务器 8.8.8.8 添加到 /etc/resolv.conf 文件中。


0
投票

我也遇到了类似的问题,解决方法如下: 在命令中:

netstat -a -n

然后它给出一个代理列表。尝试一个(ID:端口)和(任何包,例如 pandas):

pip install --proxy="https://ID:port" package

可能会出错,但继续:

C:\...\python.exe -m pip install --upgrade pip

(C:..) 是Python.exe 在您计算机上的路径。这样就更新了点。 然后:(包名称)

pip install package

这个方法对我很有帮助。我希望它对其他人有用。

© www.soinside.com 2019 - 2024. All rights reserved.