Matplotlib安装问题.Pip Centos - 安装时Freetype"Missing"

Joh*_*n Z 9 django centos matplotlib freetype virtualenv

我正在使用virtualenv进行django设置.我正在尝试构建一个视图,从日志中提取数据,然后绘制数据图.最终我想拥有这个实时和现场.如果您对其他最适合我项目的解决方案有任何建议,请不要犹豫,将它们包含在下面的评论栏中.

我试图使用pip install matplotlib从pip安装matplotlib.

我收到以下消息:

* The following required packages can not be built:
* freetype
Run Code Online (Sandbox Code Playgroud)

然后我验证它已安装

yum install freetype 
Package freetype-2.3.11-14.el6_3.1.x86_64 already installed and latest version
Run Code Online (Sandbox Code Playgroud)

然后我发现有一个python-matplotlib是旧版本.99.但是,我希望将其保留在虚拟环境中而不是系统范围内.

find / -name *freetype*
/var/lib/yum/yumdb/f/d2807dcfe3762c0b9f8ef1d9bf0f05788e73282a-freetype-2.3.11-14.el6_3.1-  x86_64
/usr/lib64/libfreetype.so.6.3.22
/usr/lib64/libfreetype.so.6
/usr/share/doc/freetype-2.3.11
Run Code Online (Sandbox Code Playgroud)

我搜索了遍布stackoverflow,只看到了ubuntu的解决方案,没有转移到centos.

谢谢你的时间,约翰

小智 10

pip将在本地机器上编译matlibplot,因此您还需要安装freetype开发头文件.

CentOS 6 +,Fedora等:

$ sudo yum -y install freetype freetype-devel libpng-devel
Run Code Online (Sandbox Code Playgroud)

在较旧的操作系统(例如CentOS 5)上,您可能会遇到更新版本的matlibplot更具体的freetype版本问题.如果您与版本无关,那么坚持使用旧版1.3.x版本将抵消这些依赖性问题:

$ pip install matplotlib==1.3.1
Run Code Online (Sandbox Code Playgroud)

请注意,您可能需要将numpy降级到1.8才能使matplotlib 1.3正常工作.

$ pip install numpy==1.8
Run Code Online (Sandbox Code Playgroud)

祝好运!


Jey*_*Jey 1

在 matplotlib 安装上,这就是我所做的。不确定这是否会对您有帮助。只需按照此处的步骤操作: http://pkgs.org/centos-6/centos-x86_64/python-matplotlib-0.99.1.2-1.el6.x86_64.rpm.html

顺便说一句,我没有使用 pip,并且使用的是 CentOS 6.4。