首页 > 其他分享 >使用默认pypi源出现连接超时

使用默认pypi源出现连接超时

时间:2023-02-28 12:00:09浏览次数:59  
标签:mirrors simple pypi 默认 host aliyun 超时 com

背景信息

安装 dataworks sdk 时报错,原因是连接默认的 pypi 仓库超时

pip install aliyun-python-sdk-dataworks-public==4.2.1

报错信息

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) 
after connection broken
by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x10b058850>, 
'Connection to pypi.python.org timed out. (connect timeout=15)')':

解决方法

将默认的国外官网的 pypi 源替换为国内常用的 pypi 源,国内常用的 pypi 源有以下几个

命令行安装并指定 pypi 源

pip install aliyun-python-sdk-dataworks-public==4.2.1 -i http://mirrors.aliyun.com/pypi/simple/

如果出现以下报错,则还需要添加额外的选项 --trusted-host mirrors.aliyun.com

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

添加选项 --trusted-host mirrors.aliyun.com

pip install aliyun-python-sdk-dataworks-public==4.2.1 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

PyCharm 中增加 pypi 源

Pycharm->Prefercence->Manage Repositories,在此将阿里云的 pypi 源添加进去
image.png

如果出现以下报错,则还需要在右下角添加额外的选项 --trusted-host mirrors.aliyun.com

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

image.png

参考

标签:mirrors,simple,pypi,默认,host,aliyun,超时,com
From: https://www.cnblogs.com/ymsu/p/17163543.html

相关文章