Python——pip国内常用镜像

1.国内常用镜像源如下:

清华大学: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/
网易:http://mirrors.163.com

2.临时使用方法

pip install 安装包名 -i https://pypi.tuna.tsinghua.edu.cn/simple

3.永久修改

3.1windows

1.进入 C:\Users\当前使用用户
2.创建pip文件夹
在这里插入图片描述
3.在pip目录中,创建文本文档,修改文件名及格式为:pip.ini
在这里插入图片描述
4.用默认文本文档编辑器或者其他编辑器均可,打开 pip.ini,复制粘贴以下内容,并保存文件即可

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

3.2 linux

1.输入 vim ~/.pip/pip.conf(vim 或 vi 均可)
在这里插入图片描述
2.复制粘贴以下内容

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

在这里插入图片描述
3.敲击Esc键 -> 输入":wp" -> 敲击回车键即可
https://img2022.cnblogs.com/blog/1945190/202206/1945190-20220613144516196-1984443661.png

备注:
1.若 linux 操作缺失相应权限,需使用 root 用户,或使用 sudo 完成操作
2.复制粘贴的内容中的镜像地址,可以根据实际需求进行替换

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
乘风的头像乘风管理团队
上一篇 2023年3月6日 上午9:21
下一篇 2023年3月6日 上午9:24

相关推荐