Moo*_*ter 3 install pip server
我已经在Linux服务器上运行了Python 3。我需要安装一些库(显然),所以我在尝试:
pip3 install numpy
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误:
Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572828>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/numpy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572eb8>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/numpy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572be0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/numpy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572d30>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/numpy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572860>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/numpy/
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
Run Code Online (Sandbox Code Playgroud)
问题:
随意询问更多细节。
更新:
我尝试ping google.com并得到了错误:
ping: google.com: Name or service not known
Run Code Online (Sandbox Code Playgroud)
但是当我尝试时ping 8.8.8.8,我得到了:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=10.8 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=10.6 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=10.6 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=118 time=10.6 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=9 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=10 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=11 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=12 ttl=118 time=10.8 ms
64 bytes from 8.8.8.8: icmp_seq=13 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=14 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=15 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=16 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=17 ttl=118 time=10.6 ms
64 bytes from 8.8.8.8: icmp_seq=18 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=19 ttl=118 time=10.6 ms
64 bytes from 8.8.8.8: icmp_seq=20 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=21 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=22 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=23 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=24 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=25 ttl=118 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=26 ttl=118 time=10.7 ms
^C
--- 8.8.8.8 ping statistics ---
26 packets transmitted, 26 received, 0% packet loss, time 25046ms
rtt min/avg/max/mdev = 10.655/10.731/10.827/0.073 ms
Run Code Online (Sandbox Code Playgroud)
DNS可能有问题吗?我该怎么办?
Rom*_*kur 18
我刚刚重新启动了网络服务,然后重新启动了docker。使用的命令:
systemctl restart NetworkManager.service
sudo service docker restart
Run Code Online (Sandbox Code Playgroud)
小智 12
如果您尝试构建 docker 映像并--network=host在命令末尾看到此错误,请使用。
docker build -t {name} . --network=host
Run Code Online (Sandbox Code Playgroud)
我要做的就是添加nameserver 8.8.8.8到/etc/resolv.conf文件中。8.8.8.8是Google的公共免费DNS服务器的IP。因此,由于系统必须知道域名的IP地址,因此我们必须提供一种做到这一点的方法。公共DNS服务器将域名绑定到IP地址。
小智 8
检查代理设置中的代理配置。然后使用:
pip install --proxy=http://yourproxyurl:port numpy(Python package name)
Run Code Online (Sandbox Code Playgroud)
不是原始问题的答案。
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7542572828>: Failed to establish a new connection: [Errno -2] Name or service not known',)':
Run Code Online (Sandbox Code Playgroud)
当我编写 Dockerfile 时,我也遇到了同样的警告。
显然是网络问题。
但是,DNS 和从主机到 pip 源的 ping 结果都很好。最终,我从该部分的开头到结尾
删除了 Dockerfile 。
进入容器后,网络无法获取DNS服务器。pipexec
同事提醒,有变化iptables。
当对 进行更改时iptables,服务器需要重新启动 docker 引擎才能使其工作。
可能但不限于sudo service docker restart
但是,希望这个答案可以节省其他人的时间。
小智 6
对于 Windows 10 用户,请转到 Settings -> Network and Internet -> Proxy
禁用自动检测设置
小智 5
如果使用代理网络并面临同样的问题,则使用
pip install --proxy="proxy:portno" numpy
敌例:
C:\Users\Dell>pip install --proxy="10.50.225.80:3128" numpy
| 归档时间: |
|
| 查看次数: |
8595 次 |
| 最近记录: |