pip更換源,換成國內鏡像
由於使用pip或pip3安裝python第三方包時,經常出現read timed out問題,所以需要將pip的官方軟件源服務器換成國內的鏡像服務器,從而提升python軟件包安裝效率和成功率。
1、pip國內鏡像地址
阿里雲 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/
2、pip換源方法
2.1 pip永久換源
pip永久換源:(個人推薦阿里雲的源)
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
- 1
在cmd命令行中輸入上述命令即可。下圖為例
最后,升級 pip 到最新的版本后
pip install pip -U
- 1
2.2 臨時指定pip源
# 以使用清華大學的鏡像源安裝matplotlib為例 pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple/
參考博客:https://blog.csdn.net/qq_43757282/article/details/107403028