Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-在Mac OSX Snow Leopard中安装matplotlib_Python_Matplotlib_Installation - Fatal编程技术网

Python-在Mac OSX Snow Leopard中安装matplotlib

Python-在Mac OSX Snow Leopard中安装matplotlib,python,matplotlib,installation,Python,Matplotlib,Installation,我在安装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 ex

我在安装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
src/ft2font.cpp中包含的文件中的
:3:
src/ft2font.h:16:22:错误:ft2build.h:没有这样的文件或目录
src/ft2font.h:17:10:错误:#include需要“文件名”或
src/ft2font.h:18:10:错误:#include需要“文件名”或
src/ft2font.h:19:10:错误:#include需要“FILENAME”或
src/ft2font.h:20:10:错误:#include需要“文件名”或
src/ft2font.h:21:10:错误:#include需要“FILENAME”或
在src/ft2font.cpp中包含的文件中:3:
src/ft2font.h:34:错误:“FT_位图”尚未声明
src/ft2font.h:34:错误:“FT_Int”尚未声明
src/ft2font.h:34:错误:“FT_Int”尚未声明
src/ft2font.h:86:错误:在“&”标记之前应为“,”或“…”
Src/ft2Foo.h:86:错误:ISO C++禁止声明“ftyFACE”,没有类型
src/ft2font.h:132:错误:“FT_Face”未命名类型
src/ft2font.h:133:错误:“FT_矩阵”未命名类型
src/ft2font.h:134:错误:“FT_Vector”未命名类型
src/ft2font.h:135:错误:“FT_error”未命名类型
src/ft2font.h:136:错误:“FT_Glyph”未在此范围内声明
src/ft2font.h:136:错误:模板参数1无效
src/ft2font.h:136:错误:模板参数2无效
src/ft2font.h:137:错误:“FT_Vector”未在此范围内声明
src/ft2font.h:137:错误:模板参数1无效
src/ft2font.h:137:错误:模板参数2无效
src/ft2font.h:143:错误:“FT_BBox”未命名类型
src/ft2font.cpp:41:错误:“FT_库”未命名类型
src/ft2font.cpp:106:错误:变量或字段“draw\u bitmap”声明为无效
src/ft2font.cpp:106:错误:“FT_位图”未在此范围内声明
src/ft2font.cpp:106:错误:未在此作用域中声明“位图”
src/ft2font.cpp:107:错误:“FT_Int”未在此范围内声明
src/ft2font.cpp:108:错误:“FT_Int”未在此范围内声明
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/\uuuuuu-multiarray\u-api.h:1532:警告:“int\u-import\u-array()”已定义但未使用
错误:命令“/usr/bin/gcc-4.2”失败,退出状态为1

您可以通过以下方式轻松完成:


我强烈建议您使用包管理器,而不是自己编译源代码。这是更有效的

著名的软件包管理器是自制软件的一个不错的替代品:

sudo port install py27-matplotlib
我过去使用的是OSX的第三个主要软件包管理器,我发现MacPorts明显更加健壮和更新


web上的OSX包管理器(包括一些)之间有很多比较,因此您可以更好地决定要提交给哪个管理器。

我也有同样的问题。我用brew。我通过做以下操作来修复此问题

brew install freetype
brew link freetype
brew install libpng
brew link libpng
brew install matplotlib
默认情况下,brew会使freetype和libpng的系统版本保持活动状态,这就是为什么您还需要执行“brew链接”的原因。希望有帮助


更新:我现在建议使用免费版本的Anaconda Python。那么这就无关紧要了。

看起来您在使用
freetype2
时遇到了问题。有两种方法可以解决这个问题,一种是安装
python
,另一种是使用该python安装
brew安装freetype
和matplotlib。另一种选择是安装,这将为您提供更新的freetype libs。尽管您可以使用MacPorts或homebrew等软件包管理器在OS X上安装matplotlib,但如果您对仅使用XCode提供的freetype和libpng库的方法感兴趣,查看我对一个相关问题的回答。如果我运行python setup.py build或python setup.py install,它会给出上面的消息,看起来新版本的Homebrew需要使用
--force
进行链接,即
brew link--force freetype
等。除此之外,这些步骤非常有效,谢谢!
brew install freetype
brew link freetype
brew install libpng
brew link libpng
brew install matplotlib