背景資訊
安裝 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 源有以下幾個
- 阿里云 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/
命令列安裝并指定 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...

參考
- 使用默認pypi源出現連接超時的解決辦法
- GetDISyncTask
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/545284.html
標籤:Python
上一篇:【manim】之目錄影片
