Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/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
Numpy 在OS x Lion 10.7.4和Python 3.2.2上安装MatPlotLib 1.2.x_Numpy_Python 3.x_Matplotlib_Osx Lion - Fatal编程技术网

Numpy 在OS x Lion 10.7.4和Python 3.2.2上安装MatPlotLib 1.2.x

Numpy 在OS x Lion 10.7.4和Python 3.2.2上安装MatPlotLib 1.2.x,numpy,python-3.x,matplotlib,osx-lion,Numpy,Python 3.x,Matplotlib,Osx Lion,几天前我问了一个关于在同一系统上安装numpy的问题。谢天谢地,我自己设法解决了这个问题,但不幸的是,我现在无法安装matplotlib 我首先尝试了当前的分布式版本,但没有成功,所以我想我应该下载git存储库并尝试一下。我已经做到了这一点: 更改了make.osx文件,使其能够在Python 3中工作: 导入urllib->导入urllib.request urllib.urlretrieve->urllib.request.urlretrieve 即使在那之后,我仍然有一个问题,它没有找到f

几天前我问了一个关于在同一系统上安装numpy的问题。谢天谢地,我自己设法解决了这个问题,但不幸的是,我现在无法安装matplotlib

我首先尝试了当前的分布式版本,但没有成功,所以我想我应该下载git存储库并尝试一下。我已经做到了这一点:

更改了make.osx文件,使其能够在Python 3中工作: 导入urllib->导入urllib.request urllib.urlretrieve->urllib.request.urlretrieve 即使在那之后,我仍然有一个问题,它没有找到freetype2标题。我搜索了一下,发现我可以通过在setupext.py中编辑一行来解决这个问题:

“darwin”:[],->“darwin”:['/usr/local'], 但是,在使用make.osx文件时,仍然会收到一条错误消息。以下是我如何从终端调用该文件:

sudo make-f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl\u build mpl\u install 我意识到matplotlib在Python3上还没有得到官方支持,但我想也许至少有人在某处设法让它编译/安装了

任何帮助都将不胜感激

亚当

我已将我得到的错误包括在下面:

basedirlist is: ['/usr/local']
============================================================================
BUILDING MATPLOTLIB
            matplotlib: 1.2.x
                python: 3.2.2 (v3.2.2:137e45f15c0b, Sep  3 2011, 17:28:59)
                        [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.6.2rc1
             freetype2: found, but unknown version (no pkg-config)

OPTIONAL BACKEND DEPENDENCIES
                libpng: found, but unknown version (no pkg-config)
               Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: 8.5
                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must be able
                        * to "import gtk" in your build/install environment
       Mac OS X native: yes
                    Qt: no
                   Qt4: Qt: 4.7.4, PyQt4: 4.8.6
                PySide: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: matplotlib will provide
                  pytz: matplotlib will provide
adding pytz

OPTIONAL USETEX DEPENDENCIES
                dvipng: no
           ghostscript: /bin/sh: gs: command not found
                 latex: no

[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data

running build_ext
building 'matplotlib.ft2font' extension
gcc-4.2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include -I/usr/local/include -I. -I/usr/local/include/freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-3.2/src/ft2font.o
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
                 from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
                 from ./CXX/WrapPython.h:58,
                 from ./CXX/Extensions.hxx:37,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
                 from ./CXX/Python3/Exception.hxx:47,
                 from ./CXX/Python3/Objects.hxx:45,
                 from ./CXX/Python3/Extensions.hxx:52,
                 from ./CXX/Extensions.hxx:42,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
                 from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
                 from ./CXX/WrapPython.h:58,
                 from ./CXX/Extensions.hxx:37,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
                 from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
                 from ./CXX/Python3/Exception.hxx:47,
                 from ./CXX/Python3/Objects.hxx:45,
                 from ./CXX/Python3/Extensions.hxx:52,
                 from ./CXX/Extensions.hxx:42,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
lipo: can't figure out the architecture type of: /var/tmp//ccafJH1l.out
error: command 'gcc-4.2' failed with exit status 1
make: *** [mpl_build] Error 1

好的…我想我已经设法让matplotlib现在安装

首先,您需要安装numpy。我在另一篇帖子上有这样做的说明:

现在,打开Terminal并克隆matplotlib的git存储库,假设您已安装git:

git克隆git://github.com/matplotlib/matplotlib.git 这可能需要一段时间 克隆完成后,在Finder中打开用户文件夹

在用户文件夹中打开matplotlib目录

有一个名为“make.osx”的文件,请使用TextEdit或类似工具打开此文件

更改以下行:

MACOSX_部署_目标=10.6 OSX_SDK_版本=10.6 致:

MACOSX_部署_目标=10.7 OSX_SDK_版本=10.7 更改以下行:

${PYTHON}-c'导入urllib;urllib.urlretrieve${ZLIBURL},${ZLIBFILE}'&&\ ${PYTHON}-c'导入urllib;urllib.urlretrieve${PNGURL},${PNGFILE}'&&\ ${PYTHON}-c'导入urllib;urllib.urlretrieve${FREETYPEURL},${FREETYPEFILE}' 致:

${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${ZLIBURL},${ZLIBFILE}'&&\ ${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${PNGURL},${PNGFILE}'&&\ ${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${FREETYPEURL},${FREETYPEFILE}' 保存更改

在idle中打开名为setupext.py的文件

查找行“darwin”:[],并将其更改为“darwin”:['/usr/local']

保存文件

再次打开终端并键入以下内容:

sudo make-f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl\u build mpl\u install 一段时间后,应将matplotlib安装在以下目录中:

/usr/local/lib/Python3.2/site-packages/ 打开上述目录以及以下目录:

/Library/Python/3.2/site-packages/ 将以下目录从/usr/local/lib/Python3.2/site-packages/复制/移动到/Library/Python/3.2/site-packages/:

dateutil matplotlib mpl_工具包 现在应安装matplotlib

如果打开idle并键入import matplotlib,则不应返回错误

我尝试了matplotlib/examples/user_interfaces/embedded_-in_qt4_wtoolbar.py文件,它似乎工作正常

希望其他人觉得这个有用

再次感谢您的帮助


亚当。

好的……我想现在已经设法安装了matplotlib

首先,您需要安装numpy。我在另一篇帖子上有这样做的说明:

现在,打开Terminal并克隆matplotlib的git存储库,假设您已安装git:

git克隆git://github.com/matplotlib/matplotlib.git 这可能需要一段时间 克隆完成后,在Finder中打开用户文件夹

在用户文件夹中打开matplotlib目录

有一个名为“make.osx”的文件,请使用TextEdit或类似工具打开此文件

更改以下行:

MACOSX_部署_目标=10.6 OSX_SDK_版本=10.6 致:

MACOSX_部署_目标=10.7 OSX_SDK_版本=10.7 更改以下行:

${PYTHON}-c'导入urllib;urllib.urlretrieve${ZLIBURL},${ZLIBFILE}'&&\ ${PYTHON}-c'导入urllib;urllib.urlretrieve${PNGURL},${PNGFILE}'&&\ ${PYTHON}-c'导入urllib;urllib.urlretrieve${FREETYPEURL},${FREETYPEFILE}' 致:

${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${ZLIBURL},${ZLIBFILE}'&&\ ${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${PNGURL},${PNGFILE}'&&\ ${PYTHON}-c'导入urllib.request;urllib.request.urlretrieve${FREETYPEURL},${FREETYPEFILE}' 保存更改

在idle中打开名为setupext.py的文件

查找行“darwin”:[],并将其更改为“darwin”:['/usr/local']

保存文件

再次打开终端并键入t 他说:

sudo make-f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl\u build mpl\u install 一段时间后,应将matplotlib安装在以下目录中:

/usr/local/lib/Python3.2/site-packages/ 打开上述目录以及以下目录:

/Library/Python/3.2/site-packages/ 将以下目录从/usr/local/lib/Python3.2/site-packages/复制/移动到/Library/Python/3.2/site-packages/:

dateutil matplotlib mpl_工具包 现在应安装matplotlib

如果打开idle并键入import matplotlib,则不应返回错误

我尝试了matplotlib/examples/user_interfaces/embedded_-in_qt4_wtoolbar.py文件,它似乎工作正常

希望其他人觉得这个有用

再次感谢您的帮助


Adam。

您的构建环境是否不完整?关于stdarg.h的错误消息表明您缺少一个头文件。这只是一个猜测,但既然你提到了Lion,也许你应该在make命令行上设置OSX_SDK_VER=10.7。非常感谢!我将构建目标更改为10.7,现在可以运行了。再次感谢!您的构建环境是否不完整?关于stdarg.h的错误消息表明您缺少一个头文件。这只是一个猜测,但既然你提到了Lion,也许你应该在make命令行上设置OSX_SDK_VER=10.7。非常感谢!我将构建目标更改为10.7,现在可以运行了。再次感谢!做得好,解决了这一切。请前往matplotlib邮件列表,帮助他们解决如何使其更容易-做得好,解决了这一切。请前往matplotlib邮件列表,帮助他们解决如何使其更容易-