清华镜像用法

用pip安装模块时,总是会报错,大片红字,请求超时,影响心情

如果使用镜像安装,就会很顺,敲一下回车键,一两秒就搞定,节约时间

平常简单用法是:

pip install beautifulsoup4

加入镜像参数后:

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

 →  →  →  →  →  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ←  ←  ←  ←  ← 

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

 →  →  →  →  →  ↑  ↑  ↑  ↑  ↑  ↑  ↑  ↑  ↑  ↑  ←  ←  ←  ←  ← 

 

镜像使用方式:

这2种方式都可以,推荐使用第二种方式,更简便

  1. pip install -i 镜像链接 模块

  2. pip install 模块 -i 镜像链接

例如:
使用清华镜像安装scrapy模块

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

或者

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

cmd例图

清华镜像用法_第1张图片

镜像链接可以是:

清华镜像:

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

豆瓣镜像:

http://pypi.douban.com/simple

阿里云镜像:

http://mirrors.aliyun.com/pypi/simple

你可能感兴趣的:(笔记,pip)