来自清华镜像站的说明:

pypi 镜像使用帮助

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

临时使用

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

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

设为默认

升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

  1. $ pip install pip -U
  2. $ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

查看是否设置成功:

  1. $ pip config list

如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

  1. $ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

使用指定的 python 版本安装模块

  1. $ python -m pip install requests

一些命令

  • pip list : 查看全局依赖