py3.11:无法安装pip包(直接或使用require .txt)



我刚刚从github上克隆了我的一个repos来工作,却遇到了这个错误:

$ pip install -r deps/requirements.txt
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 0x7f287e110a50>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/django/

我也尝试过直接安装包:

$ pip install django
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 0x7fc4e628ba10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/django/

我也试过清空缓存,但问题仍然存在。

为什么我的pip从/simple/django/取回?

我终于设法通过改变/etc/resolv.conf使事情工作。

nameserver 8.8.8.8 # Added these lines
nameserver 8.8.4.4 # Added these lines
nameserver 127.0.0.53
options edns0 trust-ad
search .

依赖于这个问题:我如何通过resolv.conf添加DNS服务器?

更新:

不幸的是,我的方法在重新启动时被覆盖,我将继续挖掘使其永久的方法。

更新# 2

我已经设法通过更新/etc/resolvconf/resolv.conf.d/tail使我的更改永久,在每个@reboot上,系统将把文件的内容附加到/etc/resolv.conf

# Add these lines to /etc/resolvconf/resolv.conf.d/tail
nameserver 8.8.8.8 
nameserver 8.8.4.4

最新更新