windows - 在 windows 上安装 matplotlib 的问题
问题描述
我正在尝试在 Windows 上安装 matplotlib,但出现错误:
* The following required packages can not be built:
* freetype, png
* Please check http://gnuwin32.sourceforge.net/packa
* ges/freetype.htm for instructions to install
* freetype
* Please check http://gnuwin32.sourceforge.net/packa
* ges/libpng.htm for instructions to install png
虽然我已经通过 pip install 命令安装了两者:
C:\Users\Andrzej\AppData\Local\Programs\Python\Python37\Scripts>pip install freetype-py
Requirement already satisfied: freetype-py in c:\users\andrzej\appdata\local\programs\python\python37\lib\site-packages (1.2.1)
C:\Users\Andrzej\AppData\Local\Programs\Python\Python37\Scripts>pip install pypng
Requirement already satisfied: pypng in c:\users\andrzej\appdata\local\programs\python\python37\lib\site-packages (0.0.18).
我会很感激你的帮助。最好的
解决方案
错误消息中列出的 freetype 和 libpng 包是 C 库,需要安装在您的系统上以便 matplotlib 构建。不幸的是,freetype-py 和 pypng 与 C 库完全分开,不提供 matplotlib 需要的文件。
由于您可能不想自己编译这两个库,因此最好的选择是使用二进制轮安装 matplotlib,其中将包含丢失的文件。
Wheels 是为 Python 的最新稳定版本构建的,通常在可用时由 pip 使用。除非您有特殊原因运行 Python 的候选发布版本,否则您会发现通过切换到最新的稳定版本(撰写本文时为 3.6),包安装通常会减少问题。那么pip install matplotlib
应该就是你所需要的。
如果您必须使用候选发布版,您可以从Christoph Gohlke 的非官方包下载为它构建的轮子。
推荐阅读
- c++ - glm::perspective 的 fov 参数是否定义为视野角度的一半?
- javascript - vscode 有什么插件可以立即输入console.log() 来评论?
- php - 用新的短代码替换旧的短代码
- vb.net - 未安装 VS 的计算机上的 VB.net 应用程序“无法加载文件或程序集”
- python-3.x - 尝试使用漂亮的汤从 html 表中抓取特定数据
- c++ - GDB:[无可用来源]
- python - 如何将密集层单元理解为预测数据的维度?
- rasa-nlu - 无法在 rasa-nlu 中训练 LUIS 模型
- c++ - 使用本机 DOS 命令行在 Eclipse 调试器中启动 C++ 程序卡在 91%
- c++ - c++ 错误:'operator*' 不匹配(操作数类型为 'WindLogType' 和 'double')