gpt4 book ai didi

server - Python pip 在安装库时引发 NewConnectionError

转载 作者:行者123 更新时间:2023-12-04 22:39:38 26 4
gpt4 key购买 nike

我在 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('<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

问题:
  • 可能是什么问题呢?为什么会引发此错误?
  • 将来如何避免这种情况?

  • 随时询问更多细节。

    更新:
    我试过 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可能有问题?我该怎么办?

    最佳答案

    我所要做的就是添加 nameserver 8.8.8.8到/etc/resolv.conf 文件。 8.8.8.8是 Google 的公共(public)免费 DNS 服务器的 IP。因此,由于系统必须知道域名的 IP 地址,因此我们必须为其提供一种方法来做到这一 pip 。公共(public) DNS 服务器提供域名到 IP 地址的这种绑定(bind)。

    关于server - Python pip 在安装库时引发 NewConnectionError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52815784/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com