【问题标题】:Cannot `pip install numpy` on OS X Yosemite无法在 OS X Yosemite 上“pip install numpy”
【发布时间】:2014-10-30 22:14:20
【问题描述】:

升级到 OS X Yosemite 后,我无法使用 pip install pandaspip install numpy。这两个命令之前都运行良好。当我跑步时

$ pip install numpy

编译过程运行了大约 30 秒,然后我得到了这个:

编译 C 源代码

C compiler: cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe



creating build/temp.macosx-10.10-intel-2.7/numpy/linalg

creating build/temp.macosx-10.10-intel-2.7/numpy/linalg/lapack_lite

compile options: '-DATLAS_INFO="\"3.9.35\"" -I/opt/local/include -Inumpy/core/include -Ibuild/src.macosx-10.10-intel-2.7/numpy/core/include/numpy -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/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Ibuild/src.macosx-10.10-intel-2.7/numpy/core/src/private -Ibuild/src.macosx-10.10-intel-2.7/numpy/core/src/private -Ibuild/src.macosx-10.10-intel-2.7/numpy/core/src/private -Ibuild/src.macosx-10.10-intel-2.7/numpy/core/src/private -c'

cc: numpy/linalg/lapack_lite/python_xerbla.c

cc: numpy/linalg/lapack_litemodule.c

/usr/local/bin/gfortran -Wall -g -arch x86_64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.10-intel-2.7/numpy/linalg/lapack_litemodule.o build/temp.macosx-10.10-intel-2.7/numpy/linalg/lapack_lite/python_xerbla.o -L/opt/local/lib -L/usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin14.0.0/4.9.1 -Lbuild/temp.macosx-10.10-intel-2.7 -llapack -lptf77blas -lptcblas -latlas -lgfortran -o build/lib.macosx-10.10-intel-2.7/numpy/linalg/lapack_lite.so

ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64

collect2: error: ld returned 1 exit status

ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64

collect2: error: ld returned 1 exit status

error: Command "/usr/local/bin/gfortran -Wall -g -arch x86_64 -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-10.10-intel-2.7/numpy/linalg/lapack_litemodule.o build/temp.macosx-10.10-intel-2.7/numpy/linalg/lapack_lite/python_xerbla.o -L/opt/local/lib -L/usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin14.0.0/4.9.1 -Lbuild/temp.macosx-10.10-intel-2.7 -llapack -lptf77blas -lptcblas -latlas -lgfortran -o build/lib.macosx-10.10-intel-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1

----------------------------------------
Cleaning up...
Command /Users/admin/.virtualenvs/numpy_env/bin/python -c "import setuptools, tokenize;__file__='/Users/admin/.virtualenvs/numpy_env/build/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/5b/1l8zg39d48d865bktn00qnbr0000gn/T/pip-yQOlkU-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/admin/.virtualenvs/numpy_env/include/site/python2.7 failed with error code 1 in /Users/admin/.virtualenvs/numpy_env/build/numpy
Storing debug log for failure in /var/folders/5b/1l8zg39d48d865bktn00qnbr0000gn/T/tmpuDgjp9

我尝试过升级 Python,重新创建我的 virtualenv,重新启动我的系统,并把我的头撞在桌子上,但没有任何帮助。我还运行了brew rm gfortran,然后运行了brew install gcc,但这并没有帮助。

【问题讨论】:

  • 我不确定这背后的真正问题是什么,但您是否可以安装 Anaconda 发行版?我对其分发的经验是,无论操作系统如何,SciPy 堆栈几乎总是可以保证工作。
  • @ericmjl anaconda 很好,但对于想要从源代码构建的人来说,它并不能解决同样的问题,例如开发分支在发出拉取请求之前测试错误修复。
  • OSX 10.9 上的 pip install numpy 也使用二进制 Wheel 包,因此不需要构建步骤。这在 10.10 中不起作用,因为 pip 的严格平台标签检查和在 pypi.python.org/pypi/numpy/1.8.1 上发布的 macosx 轮子的文件名。未来版本的 pip 可能会解决这个问题并允许在 OSX 平台标签中向前兼容。
  • Tim:您应该将您的更新作为答案移动,并在冷却期后将其标记为有效(绿色勾号)。

标签: python macos numpy pandas osx-yosemite


【解决方案1】:

someone on twitter的推荐下,我跑了brew uninstall gcc。这导致 numpy 安装使用 XCode 提供的gcc。这似乎工作正常。

Homebrew 在 Apple 安装 4.2.1 时安装 gc 4.9。但是,我不知道根本问题是什么。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-22
    • 2015-02-12
    • 1970-01-01
    • 2015-12-06
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 2014-12-15
    相关资源
    最近更新 更多