转载请注明出处。
(1)阿里云 https://mirrors.aliyun.com/pypi/simple/
(2)豆瓣 https://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学 https://pypi.hustunique.com/
解决下载超时
pip install 库名 -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=100
# 现在timeout可以简写
pip install 库名 -i https://pypi.tuna.tsinghua.edu.cn/simple --timeout=3600
补充:
pip install -f和-i可以一块儿使用,但是-f应该放在前面:
python -m pip install paddlepaddle-gpu==2.4.1.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html -i https://pypi.mirrors.ustc.edu.cn/simple/
可以在使用pip的时候,加上参数-i和源的地址
1、pip download -d C:\Users\Administrator\Desktop\pip\package dill # dill是个像tensorflow的安装包
2、pip download -d C:\Users\Administrator\Desktop\pip\package -r C:\Users\Administrator\Desktop\pip\requirement.txt #将所有requirement.txt中的包下载到DIR这个目录中
3、pip install --no-index --find-links=DIR -r requirements.txt #可以把1中的dill写到requirements.txt中,然后使用2进行下载,最后使用3进行安装。而且在使用3安装的时候,是会自动寻找依赖的,在DIR文件夹中自动寻找所依赖的包。
4、pip download -d C:\Users\Administrator\Desktop\tensorpack-master\package2 C:\Users\Administrator\Downloads\tensorpack-master.zip -i https://pypi.tuna.tsinghua.edu.cn/simple/
#这个命令更好用,可以用来下载本地的包C:\Users\Administrator\Downloads\tensorpack-master.zip安装时所需要的依赖包;这些依赖包放在了C:\Users\Administrator\Desktop\tensorpack-master\package2里面。
5、pip install --no-index --find-links=DIR C:\Users\Administrator\Downloads\tensorpack-master.zip
用4方法下载的依赖包,可以通过5这种方式进行安装,而且会自动寻找依赖。真实方便的不行。
6、pip install --no-index --find-links=DIR C:\Users\Administrator\Downloads\tensorpack-master.zip
当你觉得你的包足够多的时候,觉得所有的依赖包,以前都已经下载过了,那么可以直接通过5的方式进行安装,而不需要经过4的下载过程。 会自动寻找依赖。真实方便的不行!
最重要的一点是:C:\Users\Administrator\Downloads\tensorpack-master.zip是我从github上下载的,而不是从pypi上下载的,也就是说,pip会自动解析从GitHub下载的.zip格式的包,尝试运行(运行其中的import),然后把需要的依赖包都下载下来。