python - 在 Windows 上安装 Matplotlib 错误 - 无法打开包含文件 'ft2build.h'
问题描述
我正在尝试matplotlib
使用以下方式安装:
pip install matplotlib
但是,我不断收到此错误:
- cannot open include file 'ft2build.h' no such file or directory
解决方案
您正在使用 python 3.8,其中没有可用的预构建whl
文件pypi
,因此您pip
正在尝试从源代码构建 matplotlib。为此,您需要下载并安装matplotlib
. 在这种情况下,ft2build.h
缺少哪个是freetype
库的一部分。
如果你真的想从源代码构建,matplotlib 开发人员提供了一个基于脚本的解决方案来下载和安装所有必需的依赖项。
由于您可能不关心从源代码构建(这在 Windows 上可能会做很多工作),因此您应该考虑以下选项之一:
whl
安装除 3.8 以外的 python 版本,它是非常新的,因此对于您要使用的模块,并不总是有官方的预构建文件- 正如 MrFuppes 建议的那样,
matplotlib‑3.2.0rc1‑cp38‑cp38‑win_amd64.whl
从这个非官方的 whl 文件集合中下载并pip install matplotlib‑3.2.0rc1‑cp38‑cp38‑win_amd64.whl
在您的 cmd 中执行
推荐阅读
- security - 如何使用 Ethereum solidity remix IDE 和 Ganache 模拟车载自组织网络 (VANET) 区块链?
- pine-script - 突出每小时蜡烛
- bash - bash shell 内置“读取”没有按预期工作
- php - getimagesize 返回图像分辨率的大值
- compiler-construction - 如何使用 libclang 将 AST 作为字符串?
- python - 在链表中递归插入节点,给定位置和值
- authentication - 使用 azure ad 登录后,着陆页不符合要求
- json - 我可以强制 SwiftUI 代码同步吗
- swift - Swifui 背景颜色没有改变
- database - tdengine 和 leveldb 中的存储模块之间最显着的区别是什么?