pip无法卸载< package&gt ;:“这是一个distutils安装的项目"; [英] pip cannot uninstall <package>: "It is a distutils installed project"

查看:287
本文介绍了pip无法卸载< package&gt ;:“这是一个distutils安装的项目";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试安装Twilio模块:

I tried to install the Twilio module:

sudo -H pip install twilio

我得到了这个错误:

Installing collected packages: pyOpenSSL
  Found existing installation: pyOpenSSL 0.13.1
Cannot uninstall 'pyOpenSSL'. It is a distutils installed project and             
thus we cannot accurately determine which files belong to it which 
would lead to only a partial uninstall.

有人知道如何卸载pyOpenSSL吗?

Anyone know how to uninstall pyOpenSSL?

推荐答案

此错误表示此软件包的元数据不包含属于该软件包的文件列表. 很可能您是通过操作系统的软件包管理器安装了此软件包,因此也需要使用它而不是pip来更新或删除它.

This error means that this package's metadata doesn't include a list of files that belong to it. Most probably, you have installed this package via your OS' package manager, so you need to use that rather than pip to update or remove it, too.

例如参见升级到pip 10:这是一个distutils安装的项目,因此我们无法准确确定哪些文件属于它,这只会导致部分卸载. ·问题#5247·pypa/pip 就是一个这样的示例,其中软件包是用apt安装的.

See e.g. Upgrading to pip 10: It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. · Issue #5247 · pypa/pip for one such example where the package was installed with apt.

或者,根据您的需求,不使用系统Python和/或其全局环境,而是创建私有的Python安装和/或环境,可能会更有效率.这里有很多选项,包括virtualenvvenvpyenvpipenv以及将Python从源代码安装到 /usr/local$HOME/$HOME/.local(或/opt/<whatever>).

Alternatively, depending on your needs, it may be more productive to not use your system Python and/or its global environment but create a private Python installation and/or environment. There are many options here including virtualenv, venv, pyenv, pipenv and installing Python from source into /usr/local or $HOME/$HOME/.local (or /opt/<whatever>).

最后,我必须对经常提出的建议进行评论(例如,在)--ignore-installed pip开关.

Finally, I must comment on the often-suggested (e.g. at pip 10 and apt: how to avoid "Cannot uninstall X" errors for distutils packages) --ignore-installed pip switch.

它可能起作用(可能会满足您的业务需求足够长的时间),但也可能以无法预测的方式破坏系统上的内容.可以肯定的一件事是:它使系统的配置不​​受支持,因此无法维护-因为您实质上已经用其他一些任意东西覆盖了发行版中的文件.例如:

It may work (potentially for a long enough time for your business needs), but may just as well break things on the system in unpredictable ways. One thing is sure: it makes the system's configuration unsupported and thus unmaintainable -- because you have essentially overwritten files from your distribution with some other arbitrary stuff. E.g.:

  • 如果新文件是与旧文件不兼容的二进制文件,则发行版本中与原始文件建立链接的其他软件将出现段错误或其他故障.
  • 如果新版本包含一组不同的文件,则最终会混合使用旧文件和新文件,这可能会破坏相关软件以及程序包本身.
  • 如果稍后使用OS的程序包管理器更改程序包,它将覆盖pip安装的文件,并具有类似不可预测的结果.
  • 如果存在诸如配置文件之类的内容,则版本之间的差异也可能导致各种损坏.
  • If the new files are binary incompatible with the old ones, other software from the distribution built to link against the originals will segfault or otherwise malfunction.
  • If the new version has a different set of files, you'll end up with a mix of old and new files which may break dependent software as well as the package itself.
  • If you change the package with your OS' package manager later, it will overwrite pip-installed files, with similarly unpredictable results.
  • If there are things like configuration files, differences in them between the versions can also lead to all sorts of breakage.

这篇关于pip无法卸载&lt; package&gt ;:“这是一个distutils安装的项目";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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