2012-05-09 6 views
4

matplotlibのインストールで問題が発生しました。他の多くのトピックと同様のエラーが発生していますが、それらのソリューションのどれも私のために働いていません。私はpipとgit経由でmatplotlibをインストールしようとしましたが、私は非常に助けを感謝するたびに同じエラーが表示されます。Python - Mac OSX Snow Leopardにmatplotlibをインストールする

In file included from src/ft2font.cpp:3: 
src/ft2font.h:16:22: error: ft2build.h: No such file or directory 
src/ft2font.h:17:10: error: #include expects "FILENAME" or <FILENAME> 
src/ft2font.h:18:10: error: #include expects "FILENAME" or <FILENAME> 
src/ft2font.h:19:10: error: #include expects "FILENAME" or <FILENAME> 
src/ft2font.h:20:10: error: #include expects "FILENAME" or <FILENAME> 
src/ft2font.h:21:10: error: #include expects "FILENAME" or <FILENAME> 
In file included from src/ft2font.cpp:3: 
src/ft2font.h:34: error: 'FT_Bitmap' has not been declared 
src/ft2font.h:34: error: 'FT_Int' has not been declared 
src/ft2font.h:34: error: 'FT_Int' has not been declared 
src/ft2font.h:86: error: expected ',' or '...' before '&' token 
src/ft2font.h:86: error: ISO C++ forbids declaration of 'FT_Face' with no type 
src/ft2font.h:132: error: 'FT_Face' does not name a type 
src/ft2font.h:133: error: 'FT_Matrix' does not name a type 
src/ft2font.h:134: error: 'FT_Vector' does not name a type 
src/ft2font.h:135: error: 'FT_Error' does not name a type 
src/ft2font.h:136: error: 'FT_Glyph' was not declared in this scope 
src/ft2font.h:136: error: template argument 1 is invalid 
src/ft2font.h:136: error: template argument 2 is invalid 
src/ft2font.h:137: error: 'FT_Vector' was not declared in this scope 
src/ft2font.h:137: error: template argument 1 is invalid 
src/ft2font.h:137: error: template argument 2 is invalid 
src/ft2font.h:143: error: 'FT_BBox' does not name a type 
src/ft2font.cpp:41: error: 'FT_Library' does not name a type 
src/ft2font.cpp:106: error: variable or field 'draw_bitmap' declared void 
src/ft2font.cpp:106: error: 'FT_Bitmap' was not declared in this scope 
src/ft2font.cpp:106: error: 'bitmap' was not declared in this scope 
src/ft2font.cpp:107: error: 'FT_Int' was not declared in this scope 
src/ft2font.cpp:108: error: 'FT_Int' was not declared in this scope 
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1532: warning: 'int _import_array()' defined but not used 
error: command '/usr/bin/gcc-4.2' failed with exit status 1 
+0

あなたは 'freetype2'に問題があるようです。その2つの方法は、[homebrew](http://mxcl.github.com/homebrew/)をインストールして 'python'をインストールし、' brew install freetype'を実行し、そのpythonでmatplotlibをインストールすることです。もう一つの方法は[Quartz X11](http://xquartz.macosforge.org/trac/wiki)をインストールすることです。これはもっと新しい、更新されたフリータイプのライブラリを提供します。 – birryree

+0

MacPortsやhomebrewのようなパッケージマネージャを使ってOS Xにmatplotlibをインストールすることはできますが、XCode提供のfreetypeとlibpngライブラリのみを使用するメソッドに興味があれば、関連する質問[ここ](http ://stackoverflow.com/a/10843478/781673)。 – mhowison

答えて

1

あなたはhomebrewで簡単な方法でドイトことができます。

$ brew install python 
$ brew install gfortran 
$ brew install pkg-config 
$ easy_install pip 
$ pip install numpy 
$ cd $HOME 
$ git clone https://github.com/matplotlib/matplotlib.git 
$ cd matplotlib 
$ python setup.py build 
$ python setup.py install 
+0

Python setup.pyビルドを実行するかPython setup.pyをインストールすると上記のメッセージが表示されます – tilteddriveway

4

を私は強く代わりに自分でソースコードをコンパイルしようとしているのパッケージマネージャを通過することをお勧めします。これははるかに効率的です。

自作の素敵な代替は、有名なMacPortsパッケージマネージャである:

sudo port install py27-matplotlib 

私は過去に、OS Xのための第三の主要なパッケージマネージャをFinkを使用し、私はMacPortsのは、はるかに堅牢でアップ見つけます現在まで。

ウェブ上のOS Xパッケージマネージャー(多くの場合、nice onesを含む)の間で多くの比較がありますので、どのマネージャーにコミットするかをよりよく判断できます。

7

私は同じ問題がありました。私は醸造を使用します。私はデフォルトでは

brew install freetype 
brew link freetype 
brew install libpng 
brew link libpng 
brew install matplotlib 

を行うことによって、これを固定し、醸造は、あなたにも「醸造リンク」を行う必要がある理由ですFreeTypeのとのlibpngアクティブ、あなたのシステムのバージョンを残します。希望が役立ちます。

アップデート:Anaconda Pythonの無料版を使用することをおすすめします。そして、これは簡単です。

+0

新しいバージョンのHomebrewのように、リンクに '--force'を使う必要があります。' brew link --force freetype'などそれより、これらのステップは完璧に働いた、ありがとう! – alexandroid

関連する問題