使用virtualenv进行pip安装Matplotlib错误 [英] Pip install Matplotlib error with virtualenv

查看:111
本文介绍了使用virtualenv进行pip安装Matplotlib错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在新的virtualenv中安装matplotlib.

I am trying to install matplotlib in a new virtualenv.

当我这样做时:

pip install matplotlib

pip install http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.tar.gz

我收到此错误:

building 'matplotlib._png' extension

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -  DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include -I. -I/home/sam/django-projects/datazone/local/lib/python2.7/site-packages/numpy/core/include -I. -I/usr/include/python2.7 -c src/_png.cpp -o build/temp.linux-x86_64-2.7/src/_png.o

src/_png.cpp:10:20: fatal error: png.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

任何人都知道发生了什么事吗?

Anyone have an idea what is going on?

非常感谢您的帮助.

推荐答案

构建Matplotlib需要不是Python库的libpng(以及freetype),因此pip无法处理安装(或freetype).

Building Matplotlib requires libpng (and freetype, as well) which isn't a python library, so pip doesn't handle installing it (or freetype).

您需要按照libpng-develfreetype-devel的方式(或与您的操作系统等效的方式)进行安装.

You'll need to install something along the lines of libpng-devel and freetype-devel (or whatever the equivalent is for your OS).

有关matplotlib的信息,请参见构建要求/说明.

See the building requirements/instructions for matplotlib.

这篇关于使用virtualenv进行pip安装Matplotlib错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆