pip install matplotlib fails: 'cannot build package freetype; “python setup.py egg_info” failed with error code 1'

有些话、适合烂在心里 提交于 2019-12-07 02:23:08

问题


I want to use matplotlib.pyplot. I can't because

altoidnerd@LEPTON:~/ $ pip install matplotlib

is failing on ubuntu 14 giving an egg_info error, and warning "cannot build package freetype"

* The following required packages can not be built:

                        * freetype

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8UvQcW/matplotlib

But

altoidnerd@LEPTON:~/$ dpkg -L libfreetype6
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libfreetype.so.6.11.1
/usr/share
/usr/share/doc
/usr/share/doc/libfreetype6
/usr/share/doc/libfreetype6/FTL.TXT.gz
/usr/share/doc/libfreetype6/ft2faq.html
/usr/share/doc/libfreetype6/TODO
/usr/share/doc/libfreetype6/copyright
/usr/share/doc/libfreetype6/changelog.Debian.gz
/usr/share/doc/libfreetype6/pcf
/usr/share/doc/libfreetype6/pcf/README
/usr/lib/x86_64-linux-gnu/libfreetype.so.6

my debug.log is here: http://pastebin.com/rvDuYDiy

A discussion about this on github was closed last year, but I was unable to use it to solve the problem (I left a note):

https://github.com/matplotlib/matplotlib/issues/3029

I started a reddit thread too.


回答1:


This did the trick for me:

sudo apt-get install libfreetype6-dev pkg-config



回答2:


The following command mentioned in the github thread that you mentioned above works for me:

sudo ln -s /usr/include/freetype2/ft2build.h /usr/include/




回答3:


I had a similar issue solved by:

easy_install -U pip

pip install matplotlib


来源:https://stackoverflow.com/questions/28914202/pip-install-matplotlib-fails-cannot-build-package-freetype-python-setup-py-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!