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

问题:

执行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(s)(Redhat based systems)或DEB(s)(Debian based systems)。
要安装系统依赖关系,您将需要根据您的系统使用以下方法之一。
 Ubuntu的/ Debian的:

apt-get install libfreetype6-dev

要在Ubuntu / Debian系统上搜索软件包:

apt-cache search <string>

例如:

apt-cache search freetype | grep dev

 红帽/ CentOS的/ Fedora的:

yum -y install freetype-devel

要在Redhat / CentOS / Fedora系统上搜索软件包:

yum search <string>

例如:

yum search freetype | grep devel

 Mac OS X:via Homebrew

brew install freetype

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

brew search <string>

例如:

brew search freetype

 
 
Code问答: http://codewenda.com/topics/python/
Stackoverflow: Ubuntu running `pip install` gives error ‘The following required packages can not be built: * freetype’

*转载请注明本文链接以及stackoverflow的英文链接

发表评论

电子邮件地址不会被公开。 必填项已用*标注

2 + 4 =