python - 安装 Matplotlib 时出错:致命错误 C1083
问题描述
我对 Python 编码比较陌生,想了解 Python 中的统计和数据管理。为此,我想安装 Matplotlib,这给了我一些问题。
我看到其他人有这个问题,但我还没有完全理解如何解决它。
要安装我使用
pip install matplotlib
我安装了以下规格
- 视窗 10
- 蟒蛇 3.8
- 微软工作室 2019
我遇到的第一个错误是安装 Microsoft Studio,所以我这样做了。我也尝试过更新点子
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
它时,它会从轮子上安装已编译的版本,因此无需自己编译任何东西或使用 Microsoft Studio。
推荐阅读
- vue.js - 尝试将 TipTap WYSIWYG 添加到 Vue 表单文本区域
- c# - EntityReference 不能有超过一个相关对象 - 使用 LINQ 多对多
- python - 使用复杂的条件逻辑连接 Pyspark 数据帧(可能使用映射代替)
- mysql - TOP 函数的工作方式与 mysql 中的 LIMIT 不同吗?
- java - 使用 Angular 和 Spring Boot 从本地主机获取数据
- javascript - 通过 phonegap 应用程序从同一网络中的移动设备与本地服务器通信
- javascript - 等待 Firestore 集合的导入操作完成
- javascript - 使用 Javascript 如何找到嵌套在空数组中的对象的路径?
- java - 为什么使用我的 AVL 树数据结构未获得正确的中位数?
- visual-studio-2019 - 在 Visual Studio 2019 中,如何快速从 if 语句中提取代码?