python - 安装 Matplotlib 报错 : fatal error C1083

标签 python matplotlib installation

我对 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/

相关文章:

python - 在 Python 中以前缀表示法处理命令行参数

python - 复制嵌套列表并用连续数字填充

python - 为什么我在尝试使用 asyncio 时得到 "RuntimeError: yield was used instead of yield from for generator in task Task"?

python - 即使编辑后端并使用 pylab.show() 后,matplotlib 图也不会出现

python - 使用多个分隔符在 python 中拆分字符串的最佳方法 - 同时保留分隔符

python - 通过 3D x、y、z 散点图数据拟合一条线

matplotlib - 为什么 bmp 图像在 IPython-notebook 上使用 matplotlib 的 plt.imshow 显示为错误颜色?

c++ - 制作一个安装程序,在安装后安装工具栏

linux - 在 Linux 上哪里安装 Mercanet Payment Lib

installation - 安装WampServer时出错