使用 pip 安装 Matplotlib 时遇到问题 (python 3.10 windows 11)

Troubles installing Matplotlib with pip (python 3.10 windows 11)

我在 python 3.10.0 上安装 matplotlib 时遇到很多困难 new windows11台机器。我会从上往下解释

在我的 VScode jupyter 文件中,我尝试 运行 以下代码单元格

import matplotlib

ModuleNotFoundError: No module named 'matplotlib'

我跳到我的 cmd 和 运行 以下几行:

pip install --upgrade pip

Requirement already satisfied: pip in c:\users\robbe\appdata\local\programs\python\python310\lib\site-packages

pip install wheel

Requirement already satisfied: wheel in c:\users\robbe\appdata\local\programs\python\python310\lib\site-packages

pip install matplotlib

Collecting matplotlib Using cached matplotlib-3.4.3.tar.gz (37.9 MB) Preparing metadata (setup.py) ... done all these requirements were satisfies Building wheels for collected packages: matplotlib Building wheel for matplotlib (setup.py) ... error

现在我得到一个巨大的错误

ERROR: Command errored out with exit status 1: command: 'C:\Users\robbe\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\robbe\AppData\Local\Temp\pip-install-i7jkrq6p\matplotlib_45378a3fc28d4ce6bb53fd38cb01c06b\setup.py'"'"'; file='"'"'C:\Users\robbe\AppData\Local\Temp\pip-install-i7jkrq6p\matplotlib_45378a3fc28d4ce6bb53fd38cb01c06b\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'"'"'))' bdist_wheel -d 'C:\Users\robbe\AppData\Local\Temp\pip-wheel-_bz0a7px' cwd: C:\Users\robbe\AppData\Local\Temp\pip-install-i7jkrq6p\matplotlib_45378a3fc28d4ce6bb53fd38cb01c06b
Complete output (553 lines):

随后出现另一个错误

ERROR: Failed building wheel for matplotlib Running setup.py clean for matplotlib Failed to build matplotlib Installing collected packages: matplotlib Running setup.py install for matplotlib ... error

谁能帮我解释一下这是怎么回事?我已经尝试了几乎所有可以在这里找到的解决方案(例如指定要安装的 differet matplotlib 构建或 运行 宁行 pip install --upgrade matplotlib)但我无法修复它

:(我只是想做一些图表

对不起各位,我用过这条线

pip install matplotlib==3.5.0rc1

而且这个版本的 matplotlib 确实有效!!!! :)