【问题标题】:Installing gmpy on Mac OS X Mountain Lion在 Mac OS X Mountain Lion 上安装 gmpy
【发布时间】:2013-02-28 15:00:10
【问题描述】:

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

问题是我可以在没有警告的情况下使用 Python 3+ 设置 gmpy,但不能使用 Python 2.7。

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

python setup.py install 对于 gmpy2 是:

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

【问题讨论】:

    标签: python module 32bit-64bit gmp


    【解决方案1】:

    IIRC,这个错误是因为 python 作为 32 位应用程序运行,但试图将 gmpy 编译为 64 位扩展。请参阅此问题报告:

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

    【讨论】:

    • 我已经经历过很多次了。没有解决问题。即使我运行“arch -x86_64 python setup.py install”,我也会收到同样的警告!
    • 我看到编译器参数包括 i386 和 x86_64 作为可能的架构。我这个它应该只列出一个。但我无法使用 Mac 进行任何测试。
    • 如果你有时间,我想测试一下你的想法。
    • 你能看看code.google.com/p/gmpy/issues/detail?id=69 吗?让我们在那里解决问题,我会更新我的答案。
    猜你喜欢
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-05
    • 1970-01-01
    • 2012-10-21
    • 2012-08-19
    • 2012-10-15
    相关资源
    最近更新 更多