繁体   English   中英

无法在 Python 3.10 上安装 Matplotlib

[英]Cannot install Matplotlib on Python 3.10

python3.10 -m pip install --user matplotlib

当我运行上面的程序来安装 Matplotlib 时,我不断收到以下错误。 我最初遇到 C++ 错误,我安装了 Visual Studio。

Time Elapsed 00:00:00.36
    error: command 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1:
'C:\Users\HP\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-zq_i4lrq\\matplotlib_ce44358747c74e83a93eefbdd122f13e\\setup.py'"'"'; __file__='"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-zq_i4lrq\\matplotlib_ce44358747c74e83a93eefbdd122f13e\\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\HP\AppData\Local\Temp\pip-record-yvrkad5m\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Include\matplotlib'
Check the logs for full command output.

Matplotlib 目前不支持 Python 3.10,因此您有以下选择。

  1. 降级到 Python 3.9。
  2. 安装支持 Python 3.10 的 Matplotlib 预发布版本。 这可以通过命令pip install matplotlib==3.5.0rc1来完成(我建议这样做)。

我已经有一段时间遇到同样的问题了。 我在这里找到的另一个答案是: 尝试在 Windows 中安装 matplotlib 时出错

总之, pip install --pre matplotlib也有效。

暂无
暂无

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

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