点子拒绝升级 [英] pip refuses to upgrade

查看:82
本文介绍了点子拒绝升级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前已安装pip 8.1.2.

I currently have installed pip 8.1.2.

所以我想将其升级到最新版本(9.0.1),然后执行:

So I want to upgrade it to the latest version (9.0.1) and I execute:

sudo pip install --upgrade pip


Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 846kB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

似乎它正确下载了9.0.1,但随后拒绝卸载现有安装(8.1.2)

It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)

最后,建议我使用已经提供的完全相同的说明升级

And then at the end it suggests me to upgrade using the same exact instruction I already provided!

我做错什么了吗?

推荐答案

已对Ubuntu pip版本进行了修补,以防止自我升级(阻止所有安装到系统管理文件中,该修补程序名为hands-off-system-packages.patch).您应该使用Ubuntu打包系统进行升级.提供的反馈肯定可以改善.

The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.

由于您的Ubuntu版本尚无可用的pip 9.0.1的Ubunutu软件包,因此您实际上无法以这种方式升级到较新的版本(存在

As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).

一个(丑陋的)解决方法是改用easy_install:

A (ugly) work-around is to use easy_install instead:

sudo easy_install -U pip

之所以有效,是因为尚未诱骗easy_install来阻止升级.但是,这会将系统托管文件替换为较新的pip版本.如果您的程序包管理器要重新安装python-pip程序包,它将很高兴地覆盖这些文件,并且理论上您可能会因安装失败而告终.另外,easy_install添加的文件数量比软件包要多,并且这些额外的文件可能会导致问题,尤其是在稍后更新新版本的 时. em>已打包.

This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.

如果您要使用virtualenv,则可以在其中免费升级pip,效果很好.

If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.

这篇关于点子拒绝升级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆