7

我正在尝试使用 easy_install 在 osx 上安装 pycrypto,但出现以下错误:

easy_install pycrypto
Searching for pycrypto
Reading http://pypi.python.org/simple/pycrypto/
Reading http://pycrypto.sourceforge.net
Reading http://www.pycrypto.org/
Reading http://www.amk.ca/python/code/crypto
Best match: pycrypto 2.3
Downloading http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.3.tar.gz
Processing pycrypto-2.3.tar.gz
Running pycrypto-2.3/setup.py -q bdist_egg --dist-dir /var/folders/3D/3D07iptvHZuzuYaeQDMFIU+++TI/-Tmp-/easy_install-00HgRU/pycrypto-2.3/egg-dist-tmp-BWGYsg
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
src/MD2.c:134: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/folders/3D/3D07iptvHZuzuYaeQDMFIU+++TI/-Tmp-//ccoXuPRo.out (No such file or directory)
error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1
4

4 回答 4

10

我有这个~/.bash_profile来解决这个问题:

# Set compile flags to not try to compile for PPC (no longer supported by xcode 4)
# (this is required for eg building pycrypto)
export ARCHFLAGS="-arch i386 -arch x86_64"
于 2011-05-19T17:59:47.330 回答
2

是的,这是安装 Xcode 4 的结果。它尝试为 ppc 构建,尽管 Xcode 4 不再具有相关位。请参阅此问题以了解解决方法:https ://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build

于 2011-05-19T17:18:17.983 回答
1

代码 5.1

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycrypto
于 2014-03-13T08:17:21.100 回答
0

看起来这在 OSX 10.9 中变得更加困难。这是我做的其他事情:

brew install libffi

如果您看到有关如何安装“仅桶装”的警告,则意味着自制软件没有链接它,因此您需要提供更多信息export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig。那时安装会爆炸,因为默认情况下 OSX 现在会因警告标志而死,所以也要抑制这种行为:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

然后你应该能够安装pip.

于 2014-05-05T19:40:27.997 回答