windows下Python更换国内pip源

142 阅读1分钟

前言

在windows下,使用 pip install 命令时,出现以下情况: 在这里插入图片描述 对应服务器连接失败 ,对于这种情况,可以对pip源进行更换

更换Windows源

在Windows下 进入目录

C:\Users\计算机用户名

新建一个文件夹为 pip 在这里插入图片描述 进入pip文件夹,新建一个TXT文本文件,命名为 pip.ini 在这里插入图片描述 编辑“pip.ini”文件,添加以下内容: 阿里源:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

中科大源

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

清华大学源

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

豆瓣源

[global]
index-url = http://pypi.douban.com/simple/
[install]
trusted-host = mirrors.douban.com

修改后保存

测试

pip install pyinstaller

在这里插入图片描述 成功!!!