Python 更换国内pip源(pycharm,linux,windows)

阿里云镜像地址:

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

中国科技大学镜像地址

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

豆瓣镜像地址

https://pypi.doubanio.com/simple/

清华大学镜像地址

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

中国科学技术大学镜像地址

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

网址打开都是就是一个个的扩展包链接

在这里插入图片描述

pycharm修改方法:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
一般删除原镜像比较稳妥:选中原镜像地址(点击右侧的减号),再添加上面的地址
然后一路OK就行了

linux和windows临时使用:

可以在使用pip的时候在后面加上-i参数,指定pip源
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

永久修改:

linux:

修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Windows:

直接在user目录中创建一个pip目录,如:C:\Users\jjjjj\pip
然后新建文件pip.ini,内容如下:

[global]  

timeout = 6000  

index-url = https://pypi.tuna.tsinghua.edu.cn/simple  

trusted-host = https://pypi.tuna.tsinghua.edu.cn 
发布了2 篇原创文章 · 获赞 0 · 访问量 244

猜你喜欢

转载自blog.csdn.net/qq_40332085/article/details/104362835