清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
note:新版ubuntu要求使用https源,要注意。
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
windows下,直接在user目录中创建一个pip目录,再新建文件pip.ini。
(例如:C:\Users\你的用户名\AppData\Roaming\pip)内容同上。

解决办法是上面配置文件里的url写的有问题,如果不想麻烦尽量直接复制用清华大学的url
帖一个豆瓣镜像站的书写规范代码
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
本文介绍了如何在Python中使用国内镜像源来加速pip的包安装,包括临时和永久修改方法,并提供了清华、阿里云等镜像的地址。同时,针对可能出现的报错,给出了配置文件URL书写规范的解决建议。
1683

被折叠的 条评论
为什么被折叠?



