我在升级到OS X Yosemite之后无法使用pip install pandas
或pip 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、重新创建虚拟环境、重启系统以及在桌子上摔头,但这些都没有帮助。我还运行了brew rm gfortran
,然后是brew install gcc
,但这也没有帮助。
pip install numpy
也使用二进制轮包,因此不需要构建步骤。但是,在10.10上由于pip的严格平台标签检查和发布在https://pypi.python.org/pypi/numpy/1.8.1上的macosx轮包文件名,这种方法无法工作。未来版本的pip可能会修复这个问题,并允许在OSX平台标签中进行向前兼容。 - ogrisel