Matplotlib:命令以状态1退出。

4

我想用命令提示符中的 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 - powerPixie
这会产生以下错误 ERROR: 找不到满足要求 install(来自版本:none) ERROR: 没有找到匹配的发行版 - zest16
1
在Python 3.8上,matplotlib 3.1.1没有可用的轮子。除非您想从源代码构建matplotlib,请改用Python 3.7。另请参见此链接 - ImportanceOfBeingErnest
1
@ ImportanceOfBeingErnest。我删除了我的帖子。我怀疑你给我点了踩,我的建议是解决pip问题。没有提到matplotlib。 - powerPixie
谢谢@ImportanceOfBeingErnest,我改成了3.7.5版本,这次可以工作了。 - zest16
3个回答

4

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

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

解释:

由于没有现成的wheels,因此在python 3.8上安装matplotlib 3.1.1需要从源代码构建。这个过程可能有点繁琐。所以对于任何遇到问题的人,可以选择以下两种方法:

1. 在python 3.7上安装matplotlib 3.1.1

2. 等待matplotlib 3.2.0发布相应的python 3.8 wheels版本。

此外,有人指出可以在此处找到存储的wheels:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

但是我自己没有尝试过。

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


按照您的步骤进行操作,解释得非常好,但是仍然遇到了相同的错误。 - subhashis

0

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


-1

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

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


这不是pip的问题,而是Python 3.'o'版本的问题。 - subhashis

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