设置pip镜像网站,加快下载速度

语法:

pip -v config     
ERROR: Need an action (debug, edit, get, list, set, unset) to perform.

查看

pip -v config list 

默认无任何输出。

增加

pip -v config set global.index-url http://mirrors.aliyun.com/pypi/simple/
	输出提示:Writing to C:\Users\someone\AppData\Roaming\pip\pip.ini
pip -v config set  install.trusted-host mirrors.aliyun.com

再次查看

pip -v config list 
输出
global.index-url='http://mirrors.aliyun.com/pypi/simple/'
install.trusted-host='mirrors.aliyun.com'

删除

pip -v config unset global.index-url
pip -v config unset  install.trusted-host

文件路径: C:\Users\someone\AppData\Roaming\pip\pip.ini
文件内容:

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

[install]
trusted-host = mirrors.aliyun.com

重新打开cmd窗口
执行安装:

pip install wheel

可以看到已经可以从镜像网站下载了。

Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting wheel
  Downloading http://mirrors.aliyun.com/pypi/packages/bd/7c/d38a0b30ce22fc26ed7dbc087c6d00851fb3395e9d0dac40bec1f905030c
/wheel-0.38.4-py3-none-any.whl (36 kB)
Installing collected packages: wheel
Successfully installed wheel-0.38.4
WARNING: You are using pip version 21.2.4; however, version 22.3.1 is available.
You should consider upgrading via the 'D:\tool\Python\python.exe -m pip install --upgrade pip' command.

总结:
config list和直接写文件效果一样。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值