【问题标题】:Matplotlib: Command errored out with exit status 1Matplotlib:命令出错,退出状态为 1
【发布时间】:2020-03-07 22:13:50
【问题描述】:

我想在命令提示符中使用pip install matplotlib 为Python 安装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,但它不起作用。

【问题讨论】:

  • 看来pip有问题。尝试以下操作: pip install -U setuptools pip install -U wheel
  • 这给出了以下错误ERROR: Could not find a version that satisfies the requirement install (from versions: none) ERROR: No matching distribution found for install
  • python 3.8 上没有 matplotlib 3.1.1 的轮子。除非您想从源代码构建 matplotlib,否则请改用 python 3.7。另请参阅this。
  • @ImportanceOfBeingErnest。我删除了我的帖子。我怀疑你对我投了反对票,我的建议是解决点子问题。没有提到 matplotlib。
  • 感谢@ImportanceOfBeingErnest,我改成了 3.7.5,这次确实有效。

标签: python python-3.x matplotlib pip python-packaging


【解决方案1】:

pip install --pre -U scikit-learn 这个命令对我有用 我发现这个错误是由于相同库的重复而出现的。

【讨论】:

    【解决方案2】:

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

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

    解释:

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

    在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

    【讨论】:

    • 按照你的步骤,一个很好的解释,但得到同样的错误
    【解决方案3】:

    尝试使用管理员权限运行命令提示符

    如果问题仍然存在,请尝试重新安装 pip

    【讨论】:

    • 这不是pip的问题,是Python 3.'o'版本的问题
    猜你喜欢
    • 2021-10-29
    • 2021-05-31
    • 2020-03-05
    • 2020-02-24
    • 2021-08-07
    • 1970-01-01
    • 2020-07-08
    • 1970-01-01
    相关资源
    最近更新 更多