Python pip源处理

pypi 镜像使用帮助

pypi 镜像每 5 分钟同步一次。

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

注意,simple 不能少, 是 https 而不是 http

设为默认

修改 ~/.config/pip/pip.conf (Linux), %APPDATA%\pip\pip.ini (Windows 10) 或 $HOME/Library/Application Support/pip/pip.conf (macOS) (没有就创建一个), 修改 index-url至tuna,例如

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

pip 和 pip3 并存时,只需修改 ~/.pip/pip.conf

 

安装语句

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests

[root@nod02 alertscripts]# yum install python2-pip -y

posted on 2018-08-06 19:19  90500042陈  阅读(153)  评论(0编辑  收藏  举报