【Python】Windows系统 pip 换源方法(永久 / 临时)

pip 换源

首先国内较好的镜像地址有:

text 复制代码
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple
豆瓣:http://pypi.douban.com/simple
腾讯:http://mirrors.cloud.tencent.com/pypi/simple

临时换源:

python 复制代码
pip install 模块名 -i 镜像地址

永久换源

在终端运行:

python 复制代码
pip config list -v

当前用户的pip配置文件为 C:\Users${username}\pip\pip.ini

我们把当前用户下的pip源更换为国内源

进入C:\Users${username}\下,新建pip文件夹,在其中再新建pip.ini文件,文件内容:

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

这里是清华源,根据需要自行更改

再次运行pip config list -v

更换源成功。

相关推荐
Richard.Wong3 小时前
Windows IIS 服务器部署 Vue3 前端项目详细流程
服务器·前端·windows
二进制杯莫停5 小时前
A和B环境的python版本相同,B环境无法安装pip依赖,离线安装
开发语言·python·pip
wyg_0311138 小时前
Intel Arc 140T + Triton(Windows)环境搭建全过程记录
windows
程序猿小玉兒9 小时前
Quartz定时任务偶尔不执行
服务器·windows·microsoft
曹牧1 天前
C#:`JsonConvert.DeserializeObject`
windows·c#
JckOLF04Z1 天前
软件项目“免坑”指南
windows
imperialeast1 天前
WinAXP音乐播放器8月4日更新
windows·算法·ui
aGdF8E3gQ1 天前
16. LangChain ChatPromptTemplate多模态应用实战
windows·langchain
IT小盘1 天前
17-构建Prompt测试集-提示词优化不再凭感觉
服务器·windows·prompt
神奇霸王龙1 天前
Agent 5 场景屠夫:跨厂商基座横评
人工智能·windows·ai·dubbo·agent·ai编程·阿里