您的位置:首页 > 运维架构 > Linux

CentOS解决pip 安装M2Crypto失败

2016-01-13 21:03 1096 查看
pip install M2Crypto
报错信息:

swig -python -I/usr/local/include/python2.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
/usr/include/openssl/opensslconf.h:31: Error: CPP #error ""This openssl-devel package does not work your architecture?"". Use the -cpperraswarn option to continue swig processing.
error: command 'swig' failed with exit status 1

----------------------------------------
Command "/usr/local/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-_WW9OZ/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --r
或者报错:
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.6 -I/usr/include -includeall -modern -builtin -outdir build/lib.linux-i686-2.6/M2Crypto -D__i386__ -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
swig error : Unrecognized option -builtin
Use 'swig -help' for available options.
error: command 'swig' failed with exit status 1
以上都是swig的报错,原因是swig的版本过低导致的。
查看swig版本1.3.已经比较老旧了,swig -python -help 也未找到相关options:
[root@localhost ~]# rpm -qa | grep swig
swig-1.3.40-6.el6.x86_64
解决办法有两个:
升级swig版本

wget -O swig-3.0.7.tar.gz http://prdownloads.sourceforge.net/swig/swig-3.0.7.tar.gz tar zxf swig-3.0.7.tar.gz
cd swig-3.0.7
./configure --prefix=/usr
make && make install


2.手动安装M2Crypto
[root@localhost ~]#wget
[root@localhost ~]#unzip master.zip
[root@localhost ~]#cd M2Crypto-master
[root@localhost ~]#python setup.py install
success!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  swig M2C rypto