跳转至

使用智星云pip源

1.临时使用

pip install xxxx -i http://mirrors.blockelite.cn:15019/pip/pypi/+simple/ --trusted-host mirrors.blockelite.cn

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

2.永久设定

编辑 pip 的配置文件 pip.conf,将 index-url 修改为镜像站的地址。

pip 的配置文件一般位于(如果没有该文件,请直接创建):

· Unix/Linux:   $HOME/.pip/pip.conf
· macOS:        $HOME/Library/Application Support/pip/pip.conf
· Windows:      %APPDATA%\pip\pip.ini

修改后的 pip 配置文件示例如下:

[global]
index-url = http://mirrors.blockelite.cn:15019/pip/pypi/+simple/
format = columns
trusted-host = mirrors.blockelite.cn

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

使用 pip 时如果出现

 configparser.MissingSectionHeaderError: File contains no section headers.,

说明 pip.conf 没有加上 [global] 这一行。