首页 > 解决方案 > Matplotlib:命令出错,退出状态为 1

问题描述

我想在命令提示符下安装matplotlibPython 包,pip install matplotlib但突然这些行变红并出现下一个错误:

ERROR: Command errored out with exit status 1: 'c:\users\pol\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Pol\\AppData\\Local\\Temp\\pip-install-v44y041t\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Pol\\AppData\\Local\\Temp\\pip-install-v44y041t\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Pol\AppData\Local\Temp\pip-record-d5re6a86\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

我使用的是 Windows,我的 Python 版本是 3.8.0。我已经尝试过python -m pip install matplotlib,但它不起作用。

标签: pythonpython-3.xmatplotlibpippython-packaging

解决方案


有同样的问题。遇到了一个解决方案(据我所知,这是最近的):

python -m pip install -U matplotlib==3.2.0rc1

解释:

由于没有可用的轮子,因此在 python 3.8 上安装 matplotlib 3.1.1 需要从源代码构建它。这个过程可能会有点麻烦。因此,对于任何对此有疑问的人,要么

在 python 3.7 上安装 matplotlib 3.1.1 等待 matplotlib 3.2.0 与 python 3.8 的相应轮子一起发布

此外,有人指出存储在这里的轮子: https ://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

但我自己还没有尝试过。

来源:https ://github.com/matplotlib/matplotlib/issues/15041


推荐阅读