简体   繁体   English

使用pip在Mac OS X上安装pycrypto时出现Broken Pipe错误

[英]Broken Pipe error when using pip to install pycrypto on Mac OS X

I am attempting to install pycrypto (version 2.3) on OS X via pip. 我试图通过pip在OS X上安装pycrypto(版本2.3)。 I am getting a "Broken pipe" error when the compiler attempts to compile MD2.c. 当编译器尝试编译MD2.c时,我收到“Broken pipe”错误。 I get a very similar error when using easy_install. 使用easy_install时出现非常类似的错误。

Here is the error that I am getting: 这是我得到的错误:

bash-3.2$ 
bash-3.2$ sudo pip install pycrypto
Password:
Downloading/unpacking pycrypto
  Running setup.py egg_info for package pycrypto
Installing collected packages: pycrypto
  Running setup.py install for pycrypto
    warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Hash.MD2' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -fwrapv -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.6-universal-2.6/src/MD2.o
    /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/tmp//cc47qHNI.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/damusin/tmp/pycrypto/pycrypto-2.3/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-W6xQ61-record/install-record.txt:
    running install

running build

running build_py

running build_ext

warning: GMP library not found; Not building Crypto.PublicKey._fastmath.

building 'Crypto.Hash.MD2' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -fwrapv -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.6-universal-2.6/src/MD2.o

/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/tmp//cc47qHNI.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/damusin/tmp/pycrypto/pycrypto-2.3/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-W6xQ61-record/install-record.txt failed with error code 1
Storing complete log in /Users/admin/.pip/pip.log
bash-3.2$ 
bash-3.2$ 

I attempted to install this package using mac ports with the command "sudo port install py26-crypto", and looks to install smoothly but then it tells me that the pycrypto package is missing when running the command "fab" (Fabric). 我尝试使用带有命令“sudo port install py26-crypto”的mac端口安装此软件包,并且看起来顺利安装但是它告诉我在运行命令“fab”(Fabric)时缺少pycrypto软件包。

I attempted using the "ARCHFLAGS" command recommended in answer by YH Wong here but no luck: https://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build 我尝试使用YH Wong在这里推荐的“ARCHFLAGS”命令,但没有运气: https ://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken -pipe-期间建造

I am using Mac OS X 10.6.7 with python 2.6.6 and XCode is installed. 我正在使用带有python 2.6.6的Mac OS X 10.6.7并安装了XCode。

If you have installed Xcode 4, try setting ARCHFLAGS before calling pip or easy_install : 如果您已经安装了Xcode 4, ARCHFLAGS在调用pipeasy_install之前尝试设置ARCHFLAGS

sudo bash
export ARCHFLAGS='-arch i386 -arch x86_64'
pip ...

The problem is that Xcode 4 has removed support for -arch ppc but the system Python 2.6 on Mac OS X 10.6 expects to build universal C extension modules with all three architectures. 问题是Xcode 4已经删除了对-arch ppc支持,但Mac OS X 10.6上的系统Python 2.6期望构建具有所有三种体系结构的通用C扩展模块。 And if you define the environment variable prior to the sudo command, it will likely not be exported through to the sudo environment. 如果在sudo命令之前定义环境变量,则可能无法将其导出到sudo环境。

Xcode 5.1

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip2.7 install pycrypto

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM