2

我正在尝试安装 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编译器。现在,当我下载 numpy 的 .tar 并执行以下步骤时:

> 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")

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

4

2 回答 2

2

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

于 2013-06-08T20:58:34.837 回答
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/

于 2013-06-08T19:10:10.840 回答