使用默认pypi源出现连接超时
阅读原文时间:2023年08月15日阅读:1

背景信息

安装 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 源添加进去

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

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

参考

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章