python - 安装 matplotlib 错误 : Command errored out with exit status -4

标签 python numpy matplotlib pip

我正在尝试在我的 python 环境(rosnav)中安装 matplotlib,但我不断收到相同的错误:

(rosnav) ➜  ~ pip install matplotlib          
Collecting matplotlib
  Using cached matplotlib-3.3.4.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status -4:
     command: /home/vis2020/python_env/rosnav/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-c45rjl2z
         cwd: /tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/
    Complete output (19 lines):
    
    Edit setup.cfg to change the build options; suppress output with --quiet.
    
    BUILDING MATPLOTLIB
      matplotlib: yes [3.3.4]
          python: yes [3.6.9 (default, Jan 26 2021, 15:33:00)  [GCC 8.4.0]]
        platform: yes [linux]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
          macosx: no  [Mac OS-X only]
    
    running egg_info
    creating /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info
    writing /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/dependency_links.txt
    writing namespace_packages to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/namespace_packages.txt
    writing requirements to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/requires.txt
    writing top-level names to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/SOURCES.txt'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/22/d4/e7ca532e68a9357742604e1e4ae35d9c09a4a810de39a9d80402bd12f50f/matplotlib-3.3.4.tar.gz#sha256=3e477db76c22929e4c6876c44f88d790aacdf3c3f8f3a90cb1975c0bf37825b0 (from https://pypi.org/simple/matplotlib/) (requires-python:>=3.6). Command errored out with exit status -4: python setup.py egg_info Check the logs for full command output.

我一直在寻找解决方案,他们基本上都告诉我运行
pip install --upgrade setuptools
以一种或另一种方式。但这到目前为止对我不起作用..
有人遇到过相同或类似的问题吗?
谢谢!

最佳答案

  • 这个问题与一个 numpy 问题有关:
  • 正在安装 NumPy 1.19.5,但 OpenBLAS 似乎存在问题
  • https://github.com/numpy/numpy/issues/18131

  • https://github.com/matplotlib/matplotlib/issues/19250
  • https://forums.developer.nvidia.com/t/troubles-installing-matplotlib-on-nano-with-python-3-7-3-8-and-a-virtual-env/166837

  • 降级或安装 Numpy 1.19.4
  • 升级或安装 Numpy 1.20.x(如果您使用的是 python > 3.6)

  • 解决方案
    pip install --upgrade pip setuptools wheel
    pip install numpy==1.19.4
    pip install matplotlib
    

    关于python - 安装 matplotlib 错误 : Command errored out with exit status -4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67588980/

    相关文章:

    python - 如何在同一张图中绘制 Tensorboard 中的多个标量而不向实验列表发送垃圾邮件?

    python - Numba 在频率计数方面比纯 Python 慢

    python - 将文本放入 matplotlib 中的绘图中

    python - Pyplot 如何从多个列表的平均值创建直方图?

    python - 如何为轴添加第二行标签

    python - 为分类数据绘制多个条形图

    python - Pandas 分层列

    python - 如何通过Python从Azure订阅获取所有资源的详细信息

    python - 没有重复的列表的笛卡尔积

    python - Numpy:修改特定位置的数组元素