让python pip使用国内镜像

• 国内源:
清华: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/
• 临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple crypto,这样就会从清华这边的镜像去安装crypto库。
在这里插入图片描述
然后打开eclipse  Perferences  PyDev  Python Interpreter的界面点击Restore Defaults,在弹出的窗口选中crypto
在这里插入图片描述
• 永久修改,一劳永逸:
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\xxx\pip\pip.ini)内容同上。
在这里插入图片描述
注:有些库安装报错,可以把pip升级,再安装就不报错了
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41468794/article/details/86622140
今日推荐