python安装第三方库失败?

发布时间 2023-03-24 14:52:33作者: dcwange11
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fdcbaaeb7d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/jupyter/

这从报错中看出大致是因为pip源连接验证失败,解决办法是将pip源换成国内源,例如想安装jupyter,命令为:

pip install jupyter -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

记得复制粘贴时,将示例中的 jupyter 更换为你需要install的名字呐.

在示例中,我使用了豆瓣(douban)源,除了豆瓣之外,还有几个国内源可以备选:

阿里源 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/