无法在 Mac OS X 10.7 上使用 pip 和 Homebrew 安装 numpy 失败

无法在 Mac OS X 10.7 上使用 pip 和 Homebrew 安装 numpy 失败

numpy我正在尝试在运行 10.7.5 的 Mac 上安装

我执行了以下命令

sudo /usr/local/bin/python /usr/local/bin/pip install numpy

并且错误与ld: library not found for -lcrt1.10.6.o 以下是完整的输出有关:

sudo /usr/local/bin/python /usr/local/bin/pip install numpy

Downloading/unpacking numpy
  Running setup.py egg_info for package numpy
    Running from numpy source directory.
    non-existing path in 'numpy/distutils': 'site.cfg'
    F2PY Version 2
    blas_opt_info:
      FOUND:
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3)]
        extra_compile_args = ['-msse3', '-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 = ['-msse3']

build_src
building py_modules sources
building library "npymath" sources
customize Gnu95FCompiler
Found executable /usr/local/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: xcrun clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

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/src/npysort -Inumpy/core/include -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'
xcrun: _configtest.c
xcrun clang _configtest.o -o _configtest
ld: library not found for -lcrt1.10.6.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lcrt1.10.6.o
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 "<string>", line 16, in <module>
  File "/private/tmp/pip-build-root/numpy/setup.py", line 214, in <module>
    setup_package()
  File "/private/tmp/pip-build-root/numpy/setup.py", line 207, in setup_package
    configuration=configuration )
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/core.py", line 186, in setup
    return old_setup(**new_attr)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/egg_info.py", line 8, in run
    self.run_command("build_src")
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 152, in run
    self.build_sources()
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 163, in build_sources
    self.build_library_sources(*libname_info)
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 298, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 648, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
Complete output from command python setup.py egg_info:
Running from numpy source directory.

non-existing path in 'numpy/distutils': 'site.cfg'

F2PY Version 2

blas_opt_info:

FOUND:

extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']

define_macros = [('NO_ATLAS_INFO', 3)]

extra_compile_args = ['-msse3', '-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 = ['-msse3']



running egg_info

running build_src

build_src

building py_modules sources

building library "npymath" sources

customize Gnu95FCompiler

Found executable /usr/local/bin/gfortran

customize Gnu95FCompiler

customize Gnu95FCompiler using config

C compiler: xcrun clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes



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/src/npysort -Inumpy/core/include -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'

xcrun: _configtest.c

xcrun clang _configtest.o -o _configtest

ld: library not found for -lcrt1.10.6.o

clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: library not found for -lcrt1.10.6.o

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 "<string>", line 16, in <module>

  File "/private/tmp/pip-build-root/numpy/setup.py", line 214, in <module>

setup_package()

  File "/private/tmp/pip-build-root/numpy/setup.py", line 207, in setup_package

configuration=configuration )

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/core.py", line 186, in setup

return old_setup(**new_attr)

  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup

dist.run_commands()

  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands

self.run_command(cmd)

  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/egg_info.py", line 8, in run

    self.run_command("build_src")

  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command

self.distribution.run_command(command)

  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

cmd_obj.run()

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 152, in run

    self.build_sources()

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 163, in build_sources

self.build_library_sources(*libname_info)

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 298, in build_library_sources

sources = self.generate_sources(sources, (lib_name, build_info))

  File "/private/tmp/pip-build-root/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources

source = func(extension, build_dir)

  File "numpy/core/setup.py", line 648, in get_mathlib_info

raise RuntimeError("Broken toolchain: cannot link a simple C program")

RuntimeError: Broken toolchain: cannot link a simple C program

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip-build-root/numpy
Storing complete log in /Users/thomasrasilier/.pip/pip.log

有什么想法吗?谢谢

答案1

我终于找到了让它发挥作用的方法......更多的是尝试和错误而不是真正理解......

这招奏效了:

cd /usr/lib
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/crt1.10.6.o 

现在我可以numpy安装

sudo pip install numpy

相关内容