Installing (build) matplotlib in mac osx lion

你说的曾经没有我的故事 提交于 2019-12-03 07:54:54

问题


I installed pynum and scipy (on osx Lion with python 2.7), but when I tried to build matplotlib

git clone https://github.com/matplotlib/matplotlib.git
cd matplotlib
python setup.py build
python setup.py install

I've got these errors:

/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSTypes.h:242: error: declaration for parameter ‘FMFontDirectoryFilter’ but no such parameter
src/_macosx.m:5912: error: expected ‘{’ at end of input
lipo: can't open input file: /var/folders/qw/pr2f7vq91b3c3ngkxrrqplm8zkv09r/T//ccAgEklo.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1

Could somebody please tell me what is the problem?

P.S. At first I tried to install it in this way:

pip install -e git+https://github.com/matplotlib/matplotlib#egg=matplotlib-dev

but it does not worked for me


回答1:


I always find this process more painful than it should be, but I've done it a few times now and I believe that these steps should get you set up:

  1. Get Xcode 4.3.2, it's required for some of the later steps.
  2. Download the latest version of python for OSX from python.org
  3. Grab the Scipy superpack.
  4. Uninstall any previous versions of numpy/matplotlib/scipy that you currently have. That includes doing cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ and moving any numpy/matplotlib/scipy directories or eggs into a temp directory.
  5. cd ~/Downloads(or wherever you downloaded the superpack script to) and run sh install_superpack.sh. Answer no to the question are you installing from a repository cloned to this machine or you'll be confused about why the script keeps failing.

That should be it! You should now be able to boot up the python console and import numpy, scipy, matplotlib.



来源:https://stackoverflow.com/questions/10183144/installing-build-matplotlib-in-mac-osx-lion

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