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/
提示:若擔心安全問題請使用HTTPS加密源
修改源方法:
臨時使用:
Linux Mac Windows 通用命令
可以在使用pip的時候在后面加上-i參數(shù),指定pip源
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
永久修改:
Linux:
修改 pip.conf 文件 (沒有就創(chuàng)建一個)
$HOME/.config/pip/pip.conf
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple12
Mac:
修改 pip.conf 文件
$HOME/Library/Application Support/pip/pip.conf
如果沒有上面的目錄,在如下目錄創(chuàng)建 pip.conf
$HOME/.config/pip/pip.conf
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple12
Windows:
修改 pip.conf 文件 (沒有就創(chuàng)建一個)
%APPDATA%\pip\pip.ini
修改內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
修改文件后,執(zhí)行命令發(fā)生錯誤
使用非HTTPS加密源(如豆瓣源),在執(zhí)行命令發(fā)生錯誤,在命令最后加上--trusted-host pypi.douban.com
pip install django -i http://pypi.douban.com/simple --trusted-host pypi.douban.com