cos*_*sis 35 python gmp pycrypto osx-mountain-lion
似乎有很多人遇到过类似的问题,然而,经过多次搜索,我找不到适用于我的特定架构的解决方案.我正在尝试安装Pycrypto(作为Fabric的子公司)无济于事.
我正在通过Homebrew运行Mac 10.8.2,python 2.7.3,以及使用pip或easy_install运行XCode 4.6(我已经尝试过两者).据我所知,问题可能与我的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
- 但这也没有用.
无论我尝试什么角度,错误总是相同的(见下文).任何和所有的帮助将不胜感激.
/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
Run Code Online (Sandbox Code Playgroud)
我尝试调用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
Run Code Online (Sandbox Code Playgroud)
AKX*_*AKX 92
如果你使用Homebrew,这应该可以解决问题:
brew install gmp
env "CFLAGS=-I/usr/local/include -L/usr/local/lib" pip install pycrypto
Run Code Online (Sandbox Code Playgroud)
使用env将保证它只在这次工作.如果您需要稍后在另一个会话中安装pycrypto,请导出该变量.
export "CFLAGS=-I/usr/local/include -L/usr/local/lib"
pip install pycrypto
Run Code Online (Sandbox Code Playgroud)
小智 6
我能够使用以下命令安装 PyCrypto:
CFLAGS=-I/opt/local/include pip install pycrypto
Run Code Online (Sandbox Code Playgroud)
我通过 MacPorts 安装了 GMP,在 OSX 10.8.3 上运行,使用来自 python.org 的 Python 2.7.2。在这种情况下,我将安装到 virtualenv 中。
使用 PyCrypto 时,我确实收到以下警告,但它仍然有效:
/Users/me/.virtualenvs/blah/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
Run Code Online (Sandbox Code Playgroud)