作者:别紧张-我又不是什么好人还_876 | 来源:互联网 | 2022-12-02 11:56
我已经在Linux服务器上运行了Python 3。我需要安装一些库(显然),所以我在尝试:
pip3 install numpy
这会导致以下错误:
Collecting numpy
Retrying (Retry(total=4, cOnnect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': 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(': 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(': 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(': 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(': 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
问题:
可能是什么问题呢?为什么会引发此错误?
将来如何避免这种情况?
随意询问更多细节。
更新:
我尝试ping google.com
并得到了错误:
ping: google.com: Name or service not known
但是当我尝试时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
DNS可能有问题吗?我该怎么办?
1> Mooncrater..:
我要做的就是添加nameserver 8.8.8.8
到/etc/resolv.conf文件中。8.8.8.8
是Google的公共免费DNS服务器的IP。因此,由于系统必须知道域名的IP地址,因此我们必须提供一种做到这一点的方法。公共DNS服务器将域名绑定到IP地址。