python - 使用 pip RHEL 安装 matplotlib 出现错误 "Cannot uninstall ' pyparsing'"

标签 python matplotlib pip rhel

我目前正在使用 RHEL7 并且正在尝试安装 matplotlib。当我试图做
python -m pip install -U matplotlib
或者
pip install matplotlib
我收到错误消息“无法卸载 'pyparsing'。这是一个安装了 distutils 的项目,因此我们无法准确确定哪些文件属于它,这只会导致部分卸载。”

任何帮助将不胜感激,如果您需要更多信息,我可以提供。

最佳答案

问题是pip无法正确卸载“纯”安装的软件包distutils (见详情 here)。

您可以通过删除 pyparsing 来解决问题用手:

首先,您需要确定包的路径:

$ pip list -v | grep pyparsing

你会看到类似的东西:
pyparsing           2.0.1              /path_to_the_python/site-packages

然后走这条路并删除包(注意星号):

$ rm -rf  /path_to_the_python/site-packages/pyparsing*

并再次安装它:

$ pip install pyparsing

关于python - 使用 pip RHEL 安装 matplotlib 出现错误 "Cannot uninstall ' pyparsing'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53871808/

相关文章:

Python 和 opencv : how do I convert the ALL of the background of this image to one colour or transparent

python - --use-mirrors 的规范替代

python - 如何更新交互式绘图中的颜色条

python - 使用 matplotlib 时设置 xlim 和 ylim(有些奇怪)

python - Ubuntu 16.04 中 pip3 在哪里下载 .whl 文件?

python - 如何在 virtualenv 中拥有 python 2 和 3

python - 您如何提取通过 pip 安装的软件包并导入到另一台没有互联网的计算机上?

python - 如何存储不可散列的对象

python - Scikit 学习多核 : "AttributeError: StdIn instance has no attribute ' close'"

python - 防止 matplotlib 将我的轴重新设置为零