随笔——使用pip安装时指定镜像
运行python项目时经常遇到没有xxx模块,这时用pip安装一下对应的模块即可,有一些模块下载还挺快的,但有一些就下载的很慢了,这时指定一下镜像就很快了,但每次都要去搜,又很麻烦,就在这里记录一下。
使用pip下载时指定镜像:
-
指定清华镜像:
-i https://pypi.tuna.tsinghua.edu.cn/simple
-
指定阿里云镜像:
-i https://mirrors.aliyun.com.pypi/simple
一般用清华镜像和阿里镜像基本能搞定。再记录两个镜像,需要的时候也好试试。
- 豆瓣镜像:
https://pypi.douban.com/simple/
- 百度镜像:
https://mirror.baidu.com/pypi/simple/
例子:
- 使用清华镜像安装tensorflow:
pip install tensorflow==2.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
- 使用阿里云镜像安装TensorFlow:
pip install tensorflow==2.3.0 -i https://mirrors.aliyun.com.pypi/simple