python - 运行 `pip install` 的 Ubuntu 给出错误 'The following required packages can not be built: * freetype'

标签 python ubuntu python-2.7 matplotlib pip

在执行 pip install -r requirements.txt 时,在安装 matplotlib 的阶段出现以下错误:

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [not found. pip may install it below.]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
               tornado: yes [tornado was not found. It is required for the
                        WebAgg backend. pip/easy_install may attempt to
                        install it after matplotlib.]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: no  [pkg-config information for 'freetype2' could
                        not be found.]

...

The following required packages can not be built:

                    * freetype

不应该 pip install -r requirements.txt 也安装 freetype 吗?应该如何在 Ubuntu 12.04 中安装 freetype 以便它可以与 matplotlib 一起使用?

最佳答案

没有。 pip 不会安装系统级依赖项。这意味着 pip 不会安装 RPM(Redhat 系统)或 DEB(Debian 系统)。

要安装系统依赖项,您需要根据您的系统使用以下方法之一。

Ubuntu/Debian:

apt-get install libfreetype6-dev

在基于 Ubuntu/Debian 的系统上搜索软件包:

apt-cache search <string>

例如:

apt-cache search freetype | grep dev

Redhat/CentOS/Fedora:

yum -y install freetype-devel

在基于 Redhat/CentOS/Fedora 的系统上搜索软件包:

yum search <string>

例如:

yum search freetype | grep devel

Mac OS X:(通过 Homebrew )

brew install freetype

在基于 Mac OS X 的系统上搜索软件包:

brew search <string>

例如:

brew search freetype

关于python - 运行 `pip install` 的 Ubuntu 给出错误 'The following required packages can not be built: * freetype',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20533426/

相关文章:

.net - 如何在 Ubuntu 上正确安装 dotnet ef?

ubuntu - 为什么使用 int80h 而不是 sysenter 来调用系统调用?

python-2.7 - 为什么在 Python 中 (5 % 2) 和 (-5 % 2) 都是一样的

python - python 对象的 bool 上下文

python - 简单的 Pandas 问题,Python

python - 查找 char 是否位于子字符串之前

python - Beautiful Soup 将 Unicode 字符转换为 HTML 实体

python - 在 Ubuntu 20.04 LTS 中安装 Miniconda

python - 适用于 Windows 的 Python 2.7 兼容的 AES 加密库

python - 在 Python 中缩放列表列表的列