2010-07-04 177 views
4

我在Mac OS X 10.6上安裝numpy時遇到了很多問題。當我嘗試從源代碼安裝它,我得到以下錯誤:在Mac OS X 10.6上安裝numpy時出錯10.6

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-蘋果darwin10-GCC-4.2.1(GCC)4.2.1)所以這些頭文件不太可能不存在。任何想法可能發生什麼?

謝謝。

回答

0

在默認的Python 2.6安裝中,有一個版本(雖然有點過時)已經包含在Mac OS X 10.6中的numpy。但是,如果你想要更新版本的numpy或者想要numpy + scipy,那麼我建議你閱讀我的安裝說明:Python2.6+NumPy+SciPy+MatPlotLib on Mac OS X 10.6

編輯
至於你得到的錯誤信息....注意它說「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的二進制版本。

+0

P.S.除了安裝NumPy之外,您不需要閱讀。 – 2010-07-04 05:16:10

1

我安裝了基於這兩個頁面上的OS X 10.6的所有科學包環保署包裝蟒蛇:http://cse.ucdavis.edu/~chaos/courses/nlp/Software/PythonOSXInstall.htmlhttp://www.soton.ac.uk/~fangohr/computing/pythonsoft.html

希望這是有益的。

+0

我剛試過Enthought。問題在於它似乎不適用於easy_install。如果我嘗試安裝依賴於numpy的軟件包,這是enthought的一部分,easy_install仍然在/Library/Frameworks/Python.framework/Versions中查看我的舊Python /2.6/ - 我該如何改變它? – user248237dfsf 2010-07-04 04:37:22

+0

您可以更改您的PATH環境變量,以便讓熱衷的人先出現..然後,當您鍵入easy_install,python等時,它將使用enthought版本。 – robince 2010-07-05 17:47:41