在 Mac OS X 10.6 上安装 numpy 时出错
我在 Mac OS X 10.6 上安装 numpy 时遇到很多麻烦。当我尝试从源代码安装它时,出现以下错误:
customize NAGFCompiler
Could not locate executable f95
customize AbsoftFCompiler
Could not locate executable f90
Could not locate executable f77
customize IBMFCompiler
Could not locate executable xlf90
Could not locate executable xlf
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize GnuFCompiler
Could not locate executable g77
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
/Users/Software/numpy/numpy/distutils/fcompiler/gnu.py:126: UserWarning: Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3
warnings.warn(s)
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
gcc-4.0 _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
gcc-4.0 _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
building extension "numpy.core._sort" sources
Generating build/src.macosx-10.3-fat-2.6/numpy/core/include/numpy/config.h
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccRwrtCy.out
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccRwrtCy.out
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "setup.py", line 210, in <module>
setup_package()
File "setup.py", line 203, in setup_package
configuration=configuration )
File "/Users/Software/numpy/numpy/distutils/core.py", line 186, in setup
return old_setup(**new_attr)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/install.py", line 55, in run
r = old_install.run(self)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", line 577, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/build.py", line 37, in run
old_build.run(self)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/build.py", line 134, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 152, in run
self.build_sources()
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 169, in build_sources
self.build_extension_sources(ext)
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 328, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 395, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 41, in check_types
out = check_types(*a, **kw)
File "numpy/core/setup.py", line 260, in check_types
"Cannot compile 'Python.h'. Perhaps you need to "\
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
我已经安装了 Xcode,因为我有 gcc(版本 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1),因此这些标头似乎不太可能文件不存在。知道会发生什么吗?
谢谢。
I am having lots of trouble installing numpy on Mac OS X 10.6. When I try to install it from source, I get the following error:
customize NAGFCompiler
Could not locate executable f95
customize AbsoftFCompiler
Could not locate executable f90
Could not locate executable f77
customize IBMFCompiler
Could not locate executable xlf90
Could not locate executable xlf
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize GnuFCompiler
Could not locate executable g77
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
/Users/Software/numpy/numpy/distutils/fcompiler/gnu.py:126: UserWarning: Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3
warnings.warn(s)
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
gcc-4.0 _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
gcc-4.0 _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
building extension "numpy.core._sort" sources
Generating build/src.macosx-10.3-fat-2.6/numpy/core/include/numpy/config.h
C compiler: gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
gcc-4.0: _configtest.c
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccRwrtCy.out
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from _configtest.c:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccRwrtCy.out
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "setup.py", line 210, in <module>
setup_package()
File "setup.py", line 203, in setup_package
configuration=configuration )
File "/Users/Software/numpy/numpy/distutils/core.py", line 186, in setup
return old_setup(**new_attr)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/install.py", line 55, in run
r = old_install.run(self)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", line 577, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/build.py", line 37, in run
old_build.run(self)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/build.py", line 134, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 152, in run
self.build_sources()
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 169, in build_sources
self.build_extension_sources(ext)
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 328, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/Users/Software/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 395, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 41, in check_types
out = check_types(*a, **kw)
File "numpy/core/setup.py", line 260, in check_types
"Cannot compile 'Python.h'. Perhaps you need to "\
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
I already installed Xcode since I have gcc (version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1) so it seems unlikely that these header files don't exist. Any idea what might be happening?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我根据这两个页面在 OS X 10.6 上安装了 EPD 打包的 python 以及所有科学包: http://cse.ucdavis.edu/~chaos/courses/nlp/Software/PythonOSXInstall.html http://www.soton.ac.uk/~fangohr/computing/pythonsoft.html
希望它有用。
I installed the EPD packaged python with all the scientific packages on OS X 10.6 based on these two pages: http://cse.ucdavis.edu/~chaos/courses/nlp/Software/PythonOSXInstall.html http://www.soton.ac.uk/~fangohr/computing/pythonsoft.html
Hopefully it is useful.
Mac OS X 10.6 上默认的 Python 2.6 安装中已经包含了 numpy 的一个版本(尽管有点过时)。但是,如果您想要更新版本的 numpy 或想要 numpy+scipy,那么我建议您阅读我的安装说明:Mac OS X 10.6 上的 Python2.6+NumPy+SciPy+MatPlotLib。
编辑
至于您收到的错误消息......请注意,它显示“10.4”;由于某种原因,numpy 将 Mac OS X 10.4 SDK 硬编码到其中,因此如果您尚未安装 10.4 SDK(这是可选的,默认情况下不安装),那么您将收到这些错误。如果您重新安装 Xcode,并选择 Mac OS X 10.4 SDK,以便安装它,那么应该可以解决您遇到的问题。也就是说,我强烈建议安装 Python.org 的 MacPython 2.6 和 numpy 的二进制版本。
There is a version (albeit a little bit outdated) of numpy already included on Mac OS X 10.6 in the default Python 2.6 installation. However, if you want a newer version of numpy or would like numpy+scipy, then I suggest you read my installation instructions: Python2.6+NumPy+SciPy+MatPlotLib on Mac OS X 10.6.
Edit
As to the error messages that you are getting.... note that it says "10.4"; numpy has the Mac OS X 10.4 SDK hard-coded into it for some reason, so if you have not installed the 10.4 SDK (which is optional and not installed by default), then you will get these errors. If you reinstall Xcode, and select the Mac OS X 10.4 SDK, so that it is installed, then that should fix the issues that you are getting. That said, I would strongly recommend installing Python.org's MacPython 2.6 and the binary version of numpy.