在Mac上使用pip在virtualenv内安装matplotlib [英] Installing matplotlib inside a virtualenv using pip on a Mac
问题描述
建议用于安装python matplotlib的命令为:
The command suggested* to install matplotlib for python was:
pip install -U git+git://github.com/matplotlib/matplotlib.git
选择一个virtualenv然后运行该命令后,我收到了看起来像是肯定的结果,直到:
after choosing a virtualenv and then running that command, I received what looked like positive results until:
* The following required packages can not be built:
* freetype
但是,即使在Anaconda安装中,我在整个系统上都具有freetype
或freetype2
.我尝试将各种路径添加到$PATH
中,例如:
Yet I have freetype
or freetype2
all over my system - even in the Anaconda install. I tried adding all sorts of paths to my $PATH
like:
/anaconda/include/freetype2/freetype
/anaconda/include/freetype2/
/anaconda/include/
//anaconda/include/freetype2/freetype
至少在调用which freetype
方面似乎没有任何作用.
And nothing seems to work, at least in terms of calling which freetype
.
是否存在另一种方式来显示我具有自由类型的系统?我只是滥用$PATH
吗?
*自酿的Scipy超级包装"的建议
*suggestion from "Scipy Superpack for Homebrew"
这是安装失败的全部输出:
This is the whole output of the failed install:
Downloading/unpacking git+git://github.com/matplotlib/matplotlib.git
Cloning git://github.com/matplotlib/matplotlib.git to /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Running setup.py (path:/var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build/setup.py) egg_info for package from git+git://github.com/matplotlib/matplotlib.git
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.dev1]
python: yes [2.7.6 (default, Sep 9 2014, 15:04:36) [GCC
4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.0]
dateutil: yes [using dateutil version 2.2]
pytz: yes [using pytz version 2014.7]
tornado: yes [using tornado version 4.1]
pyparsing: yes [using pyparsing version 2.0.3]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: yes [version 1.5.13]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.4 / using mock 1.0.1]
toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]
OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: yes [installing, version 81008]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype
完成命令python setup.py egg_info
的输出:
============================================================================
Edit `setup.cfg` to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.dev1]
python: yes [2.7.6 (default, Sep 9 2014, 15:04:36) [GCC
4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.0]
dateutil: yes [using dateutil version 2.2]
pytz: yes [using pytz version 2014.7]
tornado: yes [using tornado version 4.1]
pyparsing: yes [using pyparsing version 2.0.3]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: yes [version 1.5.13]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.4 / using mock 1.0.1]
toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]
OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: yes [installing, version 81008]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Storing debug log for failure in /Users/rpanos/.pip/pip.log
推荐答案
我遇到了同样的问题.它为我工作的方式如下:
I had the same issue. The way it worked for me is the following:
sudo apt-get -y build-dep matplotlib # then enter you root password
virtualenv -p python2.7 ~/venv
source ~/venv/bin/activate
密钥是安装系统范围matplotlib
依赖项的第一步. 的来源这里.
The key being the first step where system wide matplotlib
dependencies are installed. Source of this here.
这篇关于在Mac上使用pip在virtualenv内安装matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!