Pycrypto 安装致命错误:找不到 gmp.h 文件 [英] Pycrypto install fatal error: gmp.h file not found

查看:99
本文介绍了Pycrypto 安装致命错误:找不到 gmp.h 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎有很多人遇到了类似的问题,但是,经过大量搜索后,我一直无法找到适用于我的特定架构的解决方案.我正在尝试安装 Pycrypto(作为 Fabric 的子公司)但无济于事.

It seems like there are a number of people who have had a similar problem, however, after much searching I haven't been able to find a solution that works with my particular architecture. I'm trying to install Pycrypto (as a subsidiary of Fabric) to no avail.

我通过 Homebrew 运行 Mac 10.8.2、python 2.7.3 和 XCode 4.6——使用 pip 或 easy_install 安装(我都试过).据我所知,问题可能与我的 XCode 版本有关,也可能与我的库有关.XCode 的命令行工具已安装,我尝试将 setenv ARCHFLAGS "-arch i386 -arch x86_64" 放在我的 .cshrc 文件中.我也试过 ln -s/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Developer.至于库,我尝试通过 ln -s/usr/local/lib/libgmp.dylib/usr/lib/libgmp.dylib 链接它们 - 但这也不起作用.

I'm running Mac 10.8.2, python 2.7.3 via Homebrew, and XCode 4.6 -- installing with pip or easy_install (I've tried both). From what I can tell, the problem could either be with respect to my version of XCode or because of my libraries. The Command Line Tools for XCode have been installed and I have tried placing setenv ARCHFLAGS "-arch i386 -arch x86_64" in my .cshrc file. I have also tried ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer. As for the libraries, I've tried linking them via ln -s /usr/local/lib/libgmp.dylib /usr/lib/libgmp.dylib - but that also didn't work.

无论我尝试哪个角度,错误总是相同的(见下文).任何和所有帮助将不胜感激.

The error is always the same (see below) no matter what angle I attempt. Any and all help would be appreciated.

/usr/local/share/python% pip install pycrypto
Downloading/unpacking pycrypto
  Running setup.py egg_info for package pycrypto

Installing collected packages: pycrypto
  Running setup.py install for pycrypto
    building 'Crypto.PublicKey._fastmath' extension
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -pipe -mmacosx-version-min=10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -Wno-unused-value -Wno-empty-body -Qunused-arguments -fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_fastmath.c -o build/temp.macosx-10.8-intel-2.7/src/_fastmath.o
src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found
# include <gmp.h>
          ^
1 error generated.
error: command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' failed with exit status 1
Complete output from command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-Xb7nGV-record/install-record.txt --single-version-externally-managed:
running install

running build

running build_py

running build_ext

running build_configure

building 'Crypto.PublicKey._fastmath' extension

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -pipe -mmacosx-version-min=10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -Wno-unused-value -Wno-empty-body -Qunused-arguments -fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_fastmath.c -o build/temp.macosx-10.8-intel-2.7/src/_fastmath.o

src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found

# include <gmp.h>

      ^

1 error generated.

error: command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain    /usr/bin/clang' failed with exit status 1

----------------------------------------
Command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-Xb7nGV-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto
Storing complete log in /Users/me/.pip/pip.log

我尝试调用 Fabric 时的错误:

The error when I try to call Fabric:

Traceback (most recent call last):
  File "/usr/local/share/python/fab", line 5, in <module>
from pkg_resources import load_entry_point
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2815, in <module>
working_set.require(__requires__)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 690, in require
needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pycrypto>=2.1,!=2.4

推荐答案

我终于意识到问题的根源在于 Fabric 和 Pycrypto 的版本不兼容.一旦我将我的 Fabric 版本降级到 1.2.6,我就不再出现上述错误.然后,我使用 教程 作为起点.然而,尽管有教程和旧版本的 Fabric,我仍然收到 PyCrypto >= 2.1, !=2.4 错误.我最终从源代码安装了 Pycrypto 2.2(因为显然 pip 即使在指定 pip -Iv install pycrypto==2.2 每个 this 和 v. 2.6 导致 gmp.h 错误).最后,一切顺利.

I finally realized that the root of my problem was in an incompatibility between the versions of Fabric and Pycrypto. Once I downgraded my version of Fabric to 1.2.6, I no longer got the errors above. Then, I used the tutorial as a jumping off point. However, despite the tutorial and the older version of Fabric, I still got the PyCrypto >= 2.1, !=2.4 error. I eventually installed Pycrypto 2.2 from source (since apparently pip will only install v. 2.0.1 even when designating pip -Iv install pycrypto==2.2 per this and v. 2.6 resulted in the gmp.h error). Finally, everything worked.

这篇关于Pycrypto 安装致命错误:找不到 gmp.h 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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