pip pypi 使用國內源 、永久設置 pip 源

國內的pip源:

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

中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/

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

清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/

中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/

使用方法:-i 加 url

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

如果有報錯:

WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.

使用以下命令:

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

如果有報錯:

 ERROR: Cannot unpack file C:\Users\issusers\AppData\Local\Temp\pip-unpack-6x9ra6uh\simple.html (downloaded from C:\Users\issusers\AppData\Local\Temp\pip-req-build-zoljdd4t, content-type: text/html); cannot detect archive format
ERROR: Cannot determine archive format of C:\Users\issusers\AppData\Local\Temp\pip-req-build-zoljdd4t

更換源下載。


永久設置 pip 源:
用戶根目錄下編輯配置文件:

mkdir ~/.pip
# vim ~/.pip/pip.conf
[global]
timeout=600
index-url=http://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章