在 Mac OS X Mountain Lion 上安装 gmpy [英] Installing gmpy on Mac OS X Mountain Lion

查看:37
本文介绍了在 Mac OS X Mountain Lion 上安装 gmpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I cannot install gmpy (1 or 2) on OS X Mountain Lion without warnings. I tried pip, I tried compiling, I installed gcc 4.2.1 and tried to compile gmp with i386 arch (though my Mac is 64bit), none of them are working!

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

The thing is I can setup gmpy with Python 3+ without warnings but not with Python 2.7.

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

The verbose I get when I use:

python setup.py install for gmpy2 是:

python setup.py install for gmpy2 is:

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 位扩展.请参阅此问题报告:

IIRC, this error is caused because python is running as a 32-bit application but is trying to compile gmpy as 64-bit extension. See this issue report:

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

这篇关于在 Mac OS X Mountain Lion 上安装 gmpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆