繁体   English   中英

在 PyCharm 中安装 matplotlib 和 pyplot 时出错

[英]Error while installing matplotlib and pyplot in PyCharm

我新安装了 python 3.10 并将它与 PyCharm 一起使用,我在 Windows 10 上。我安装了“numpy”包,它运行良好。 我尝试安装“matplotlib”,但收到一条错误消息:

ERROR: Command errored out with exit status 1: 'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MEDVX\\AppData\\Local\\Temp\\pip-install-un3kpywl\\matplotlib_14231889845d46839010c545a31f9693\\setup.py'"'"'; __file__='"'"'C:\\Users\\MEDVX\\AppData\\Local\\Temp\\pip-install-un3kpywl\\matplotlib_14231889845d46839010c545a31f9693\\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'"'"'))' install --record 'C:\Users\MEDVX\AppData\Local\Temp\pip-record-v8ijdjvm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\include\site\python3.10\matplotlib' Check the logs for full command output.

之后,我尝试更新我的 pip,它更新到最新版本,但错误仍然存​​在。

它说“尝试从系统终端运行此命令。确保您使用为位于以下位置的 Python 解释器安装的正确版本的‘pip’:

 'C:\Users\MEDVX\PycharmProjects\pythonProject\venv\Scripts\python.exe'."`

但是当我尝试在此目录中安装/更新时,它写道:

C:\Users\MEDVX\AppData\Local\Programs\Python\Python310\python.exe: can't open file 'C:\\Users     \\MEDVX\\pip': [Errno 2] No such file or directory

我尝试了不同的命令来检查 pip 版本或安装它,但它们都返回相同的错误,如上所示。

我会说我是一个技术菜鸟,也许问题是我在做一些愚蠢而明显的事情,我怀疑我需要将它安装到另一个目录,但我不知道是哪个,或者可能与我的 PyCharm 设置?

我将不胜感激所有的帮助。

[Pycharm error][1]
[Updating my pip][2]
[error after updating the path pycharm told me][3]

https://imgur.com/a/o1YbVs5

编辑:我设法通过安装“matplotlib”Microsoft C++ Build Tools 来安装 matplotlib。但是,我无法安装 pyplot,同样的问题,即使在 PyCharm 中更新了我的 pip 后,它也会显示错误:

ERROR: Could not find a version that satisfies the requirement pyplot (from versions: none)
ERROR: No matching distribution found for pyplot

答案很简单,我必须安装“ Microsoft C++ Build Tools

我没有设法在 Pycharm 中安装 pyplot,但是在组合之后,重新启动我的电脑和 PyCharm,更新 pip 抛出我的 CMD 和 pycharm,启用交互模式, matplotlib.pyplot工作,使用 python 3.10\\3.9(没有打扰测试其他工作后的)它显示了一个图表,我用这个代码来检查:

import matplotlib.pyplot

data = (1, 2, 3, 4, 5)

fig, simple_chart = matplotlib.pyplot.subplots()

simple_chart.plot(data)
matplotlib.pyplot.show()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM