安装 matplotlib 出错:命令以 -4 的状态退出

4

我正在尝试在我的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

以某种方式或另一种方式。但到目前为止,这对我没有起作用。

有人遇到相同或类似的问题吗?

2个回答

4

解决方案

pip install --upgrade pip setuptools wheel
pip install numpy==1.19.4
pip install matplotlib

将Numpy从1.19.5降级到1.19.4解决了我的问题,谢谢! - Giorgos Betsos

0

我曾经遇到过同样的问题,我使用了以下命令:

sudo apt-get install python3-matplotlib

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接