國內常用的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/
修改方法, 永久修改
Linux
修改 pip.conf 文件 (沒有就創建一個)
$HOME/.config/pip/pip.conf
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple12
Windows
修改 pip.conf 文件 (沒有就創建一個)
%APPDATA%\pip\pip.ini
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
修改文件後,執行命令發生錯誤
使用非HTTPS加密源,在執行命令發生錯誤,在命令最後加上
--trusted-host pypi.douban.com
pip install mysql -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Mac
修改 pip.conf 文件
$HOME/Library/Application Support/pip/pip.conf
如果沒有上面的目錄,在如下目錄創建 pip.conf
$HOME/.config/pip/pip.conf
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple12