我在MacOSX10.8(MountainLion)上,刚刚安装了Python3.2.3。
使用该版本的python从虚拟环境安装pycrypto时:
$ virtualenv --no-site-packages -p /usr/local/bin/python3.2-32 venv
$ source venv/bin/activate
$ pip install pycrypto
我知道错误:
gcc-4.2 not found, using clang instead
building 'Crypto.Hash._MD2' extension
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c src/MD2.c -o build/temp.macosx-10.6-intel-3.2/src/MD2.o
src/MD2.c:30:10: fatal error: 'string.h' file not found
#include <string.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
在尝试安装cryptolar时也会发生类似的事情。
As of version 2.4, Pycrypto says it supports python 3.
我已经向xcode开发人员文件夹添加了符号链接:
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer
但该文件夹中的所有内容都是MacOSX10.7.sdk MacOSX10.8.sdk(而不是上面需要的MacOSX10.6.sdk)。
我的系统里有遗漏吗?我怎么能告诉它使用其他的sdk呢?
通过执行以下操作来实现:
如上面的注释所示,确保安装了命令行工具,该工具还安装了系统头:
按照this answer中的说明,创建指向开发人员文件夹的符号链接:
但是,仍然显示错误消息:
这与issue that Python 3.2 assumes you are using Mac OSX 10.6有关
我修复了这个问题,通过创建一个从OSX10.8环境到OSX10.6环境的符号链接来伪造OSX10.6环境:
包现在已成功安装。
相关问题 更多 >
编程相关推荐