更新pip版本遇到的问题和解决方法

 

 

当使用pip时,出现下列警告提示

WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

可以使用下列命令来进行更新pip版本

pip install --user --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple pip

查看pip版本的命令为

pip -V

再次使用pip时 会出现下列问题

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.

大致意思就是pip和python版本不匹配

解决这个问题的方法是

每次使用pip的时候 需要在前面加上 python  -m

例如 需要下载xx时

命令为

python -m pip -i install https://pypi.douban.com/simple xx

 

命令中的网址为pip源网址 国内的有以下几个

阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban) http://pypi.douban.com/simple/

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

使用国内的网址可以避免出现下载超时的情况

 

 

如果长期使用 上面的命令太过于繁琐

这就需要在C:/用户/xx  下建立一个pip目录

在C:/用户/xx/pip 下建立pip.ini文件

内容为:

[global]

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

 

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值