在CentOS上安装M2Crypto
我正在尝试在CentOS上通过编译源代码来安装M2Crypto。
我执行了一个命令:python setup.py build,
但是出现了以下错误:
/usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/local/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:28: Error: Unable to find 'openssl/opensslv.h'
SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
请给我一些建议...
普拉萨娜
6 个回答
3
安装 openssl-devel
。
7
我刚遇到这个问题。在M2Crypto的安装文件里:
Note about Fedora Core -based Distributions
----------------------------------------------------
Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.
我的解决办法是从PyPI或者从这个源代码下载源代码。然后在M2Crypto的文件夹里:
$ chmod +x fedora_setup.py
$ ./fedora_setup.py install
如果你在使用虚拟环境,记得在那个文件里修改Python解释器的路径,或者在构建之前先激活你的环境。
我系统里唯一缺少的依赖是openssl-devel
。
11
下面的内容应该可以正常工作:
env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build
补充说明:当然还需要安装 openssl-devel
这个软件包。