4

matplotlib のインストールに問題があります。他の多くのトピックで同様のエラーが発生していますが、これらの解決策はどれもうまくいきませんでした. pip および git を介して 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
4

3 に答える 3

7

私も同じ問題を抱えていました。私はブリューを使っています。私はこれを修正しました

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

デフォルトでは、brew は freetype と libpng のシステム バージョンをアクティブのままにします。そのため、"brew link" も実行する必要があります。それが役立つことを願っています。

更新: Anaconda Python の無料バージョンを使用することをお勧めします。それならこれは些細なことです。

于 2012-10-06T12:11:01.573 に答える
4

自分でソース コードをコンパイルするのではなく、パッケージ マネージャーを使用することを強くお勧めします。これははるかに効率的です。

自作に代わる優れた方法は、有名なMacPortsパッケージ マネージャーです。

sudo port install py27-matplotlib

私は過去に OS X の 3 番目の主要なパッケージ マネージャーであるFinkを使用していましたが、MacPorts の方がはるかに堅牢で最新のものであることがわかりました。

Web 上の OS X パッケージ マネージャーには多くの比較があり (いくつかの優れたものを含む)、どのマネージャーにコミットするかをより適切に決定できます。

于 2012-05-09T07:08:56.550 に答える
1

自作で簡単に行うことができます:

$ 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
于 2012-05-09T00:53:44.807 に答える