pip 清华大学镜像_pip源很慢,更改成清华的镜像地址

对吧 -_-||

正文

在使用pip安装python包是会很慢, 因为是使用国外的镜像

解决方法

安装时更改镜像地址

如我需要安装beautifulsoup4

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

参数-i制定源

国内镜像地址

清华:https://pypi.tuna.tsinghua.edu.cn/simple

实例输出

C:Users13570>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple beautifulsoup4
Collecting beautifulsoup4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3b/c8/a55eb6ea11cd7e5ac4bacdf92bac4693b90d3ba79268be16527555e186f0/beautifulsoup4-4.8.1-py3-none-any.whl (101kB)
    100% |████████████████████████████████| 102kB 148kB/s
Collecting soupsieve>=1.2 (from beautifulsoup4)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/81/94/03c0f04471fc245d08d0a99f7946ac228ca98da4fa75796c507f61e688c2/soupsieve-1.9.5-py2.py3-none-any.whl
Installing collected packages: soupsieve, beautifulsoup4
Successfully installed beautifulsoup4-4.8.1 soupsieve-1.9.5
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:Users13570>python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
Collecting pip
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 819kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-19.3.1

C:Users13570>

参考-清华大学镜像文档:

Tsinghua Open Source Mirror​mirrors.tuna.tsinghua.edu.cn
8e490e55d0a282988de7385d2c311117.png

首发链接:

首发来自微信公众号: 程序员品​mp.weixin.qq.com