numpy没有安装在macosx上

时间:2013-06-08 18:56:11

标签: macos python-2.7 numpy install biopython

我正在尝试安装numpy,以便我可以在此之后安装biopython。我已经安装了pyton 2.7,当我在命令提示符下键入python时,我得到以下内容:

python
Python 2.7.4 (v2.7.4:026ee0057e2d, Apr  6 2013, 10:15:50) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

所以我确实有C编译器。现在,当我下载.ump of numpy和tdo时,请执行以下步骤:

> tar -xzvpf numpy-1.5.1.tar.gz
> cd numpy-1.5.1/
> python setup.py build

我得到了以下错误:

Traceback (most recent call last):
  File "setupegg.py", line 17, in <module>
    from setuptools import setup
ImportError: No module named setuptools
maziz1-ml:numpy-1.5.1 maziz$ sudo python setupegg.py
Traceback (most recent call last):
  File "setupegg.py", line 17, in <module>
    from setuptools import setup
ImportError: No module named setuptools
maziz1-ml:numpy-1.5.1 maziz$ sudo python setup.py install
Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg'
F2PY Version 1
blas_opt_info:
  FOUND:
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    define_macros = [('NO_ATLAS_INFO', 3)]
    extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']

lapack_opt_info:
  FOUND:
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    define_macros = [('NO_ATLAS_INFO', 3)]
    extra_compile_args = ['-faltivec']

running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building library "npymath" sources
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
Could not locate executable gfortran
customize G95FCompiler
Could not locate executable g95
don't know how to compile Fortran code on platform 'posix'
C compiler: /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -g -O2 -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.7/include/python2.7 -c'
clang: _configtest.c
/usr/bin/clang _configtest.o -o _configtest
ld: warning: ignoring file _configtest.o, file was built for i386 which is not the architecture being linked (x86_64): _configtest.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file _configtest.o, file was built for i386 which is not the architecture being linked (x86_64): _configtest.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
  File "setup.py", line 211, in <module>
    setup_package()
  File "setup.py", line 204, in setup_package
    configuration=configuration )
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/core.py", line 186, in setup
    return old_setup(**new_attr)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/install.py", line 55, in run
    r = old_install.run(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 563, in run
    self.run_command('build')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/build.py", line 37, in run
    old_build.run(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/build_src.py", line 152, in run
    self.build_sources()
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/build_src.py", line 163, in build_sources
    self.build_library_sources(*libname_info)
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/build_src.py", line 298, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/Library/Python/2.7/site-packages/numpy-1.5.1/numpy/distutils/command/build_src.py", line 385, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 683, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")

任何想法发生了什么? 感谢

2 个答案:

答案 0 :(得分:2)

这是我的解决方案,转到: sourceforge 获取与我的python 2.7匹配的最新版本并简单安装。 感谢

答案 1 :(得分:1)

看起来你错过了一个fortran编译器和setuptools。您是否安装了开发人员工具(Xcode或独立命令行工具)?对于setuptools,已经发布了大量类似的答案。只需谷歌错误消息。

那就是说,我建议可以通过一个简单的安装程序来查看Continuum Anaconda发行版以获得大部分python科学堆栈:

https://store.continuum.io/cshop/anaconda/

它附带了biopython并且是免费的。或者,还有包含biopython的Enthought Python Distribution:

https://enthought.com/products/epd/package-index/