我对 Python 编码比较陌生,想学习 Python 中的统计和数据管理。为此,我想安装 Matplotlib,这给我带来了一些问题。
我看到其他人遇到了这个问题,但我还没有完全理解如何解决它。
安装我使用
pip install matplotlib
我安装了以下规范
- Windows 10
- python 3.8
- 微软工作室 2019
我遇到的第一个错误是安装 Microsoft Studio,所以我就这么做了。 我也尝试更新 pip
BUILDING MATPLOTLIB
matplotlib: yes [3.1.1]
python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]]
platform: yes [win32]
...
checkdep_freetype2.c
src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1:
最佳答案
你有 python 3.8,而不是 python 3.7。
但是在 pypi 上没有可用于 matplotlib 3.1.1 的 python 3.8 轮子。所以最好完全删除 python 3.8 并安装 python 3.7。
当您随后运行 python -m pip install matplotlib
时,它将从 wheels 安装编译版本,因此您无需自己编译任何东西或使用 Microsoft Studio。
关于python - 安装 Matplotlib 报错 : fatal error C1083,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58455888/