Python常用國(guó)內(nèi)pip鏡像源:
阿里云:https://mirrors.aliyun.com/pypi/simple/
百度:?https://mirror.baidu.com/pypi/simple/
清華:https://pypi.tuna.tsinghua.edu.cn/simple/
中科大:?https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣:http://pypi.douban.com/simple/
搜狐:http://mirrors.sohu.com/Python/
一、臨時(shí)設(shè)置:
在使用 pip 安裝包時(shí),加上 -i 參數(shù)指定安裝源即可,例如:
pip install -i?https://mirrors.aliyun.com/pypi/simple/?numpy #這條命令將使用阿里云 PyPI 鏡像安裝 numpy 包
二、永久設(shè)置:
可以按照以下步驟進(jìn)行操作:
(1)找到 pip 的配置文件
在命令行中輸入以下命令即可:pip config --edit
或手動(dòng)打開(kāi)文件進(jìn)行編輯:在 Windows 上,pip 的配置文件一般位于 C:\Users\用戶(hù)名\AppData\Roaming\pip\pip.ini
(2)添加軟件源
在打開(kāi)的配置文件中添加以下內(nèi)容:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
(3)保存配置文件文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-429358.html
保存修改后的配置文件即可,pip 下載包時(shí)將使用你設(shè)置的默認(rèn)源。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-429358.html
到了這里,關(guān)于python pip 下載默認(rèn)源更改(Windows)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!