没有警告,我无法在OS X Mountain Lion上安装gmpy(1或2)。我尝试了pip,尝试了编译,我安装了gcc 4.2.1并尝试使用i386 arch编译gmp(尽管我的Mac是64位的),但是它们都没有工作!

关键是我可以在没有警告的情况下使用Python 3+来设置gmpy,但不能在Python 2.7中进行设置。

使用时得到的详细信息是:

gmpy2的python setup.py install是:

running install
running build
running build_ext
building 'gmpy2' extension
creating build/temp.macosx-10.6-intel-2.7
creating build/temp.macosx-10.6-intel-2.7/src
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DWITHMPFR=1 -DWITHMPC=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/gmpy2.c -o build/temp.macosx-10.6-intel-2.7/src/gmpy2.o
In file included from src/gmpy2.c:455:
src/mpz_pylong.c: In function ‘mpn_sizebits’:
src/mpz_pylong.c:55: warning: right shift count >= width of type
src/mpz_pylong.c:55: warning: right shift count >= width of type
creating build/lib.macosx-10.6-intel-2.7
gcc-4.2 -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-2.7/src/gmpy2.o -lgmp -lmpfr -lmpc -o build/lib.macosx-10.6-intel-2.7/gmpy2.so
ld: warning: ignoring file /usr/local/lib/libgmp.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /usr/local/lib/libgmp.dylib
ld: warning: ignoring file /usr/local/lib/libmpfr.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /usr/local/lib/libmpfr.dylib
ld: warning: ignoring file /usr/local/lib/libmpc.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /usr/local/lib/libmpc.dylib
running install_lib
copying build/lib.macosx-10.6-intel-2.7/gmpy2.so -> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
running install_egg_info
Writing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gmpy2-2.0.0b4-py2.7.egg-info

最佳答案

IIRC,此错误是由于python作为32位应用程序运行,但正在尝试将gmpy编译为64位扩展而引起的。请参阅此问题报告:

https://code.google.com/p/gmpy/issues/detail?id=11&can=1&q=Mac

关于python - 在Mac OS X Mountain Lion上安装gmpy,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15138708/

10-11 01:36