pip 无法卸载 <package>: <It is an distutils installed project> [英] pip cannot uninstall <package>: "It is a distutils installed project"

查看:21
本文介绍了pip 无法卸载 <package>: <It is an distutils installed project>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试安装 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/).

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>).

最后,我必须评论经常被推荐的(例如在 pip 10 和 apt:如何避免 distutils 包的无法卸载 X"错误) --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.:

  • 如果新文件与旧文件的二进制文件不兼容,则发行版中为链接原始文件而构建的其他软件将出现段错误或其他故障.
  • 如果新版本有一组不同的文件,您最终会混合使用新旧文件,这可能会破坏相关软件以及软件包本身.
  • 如果您稍后使用操作系统的程序包管理器更改程序包,它将覆盖 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;: &lt;It is an distutils installed project&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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