Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

https://cloud.tencent.com/developer/article/1354614

报错:

'Connection to pypi.python.org timed out. (connect timeout=15)')'

原因:采用了默认的pypi源(国外的pypi源),出现连接超时问题

解决办法

国内常用的pypi源如下:

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

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

豆瓣(douban) http://pypi.douban.com/simple/

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

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

在你需要安装的xx后面添加-i + pypi源:

pip install xx -i http://pypi.douban.com/simple/

如果还出现下面的情况:

pypi.douban.com is not a trusted or secure host and is being ignored...

那么命令就变成这样:

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

评论