CentOS解决pip 安装M2Crypto失败

1
pip install M2Crypto

报错信息:

1
2
3
4
5
6
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

或者报错:

1
2
3
4
5
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:

1
2
[root@localhost ~]# rpm -qa | grep swig
swig-1.3.40-6.el6.x86_64

解决办法有两个:

  1. 升级swig版本

1
2
3
4
5
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

1
2
3
4
[root@localhost ~]#wget 
[root@localhost ~]#unzip master.zip
[root@localhost ~]#cd M2Crypto-master
[root@localhost ~]#python setup.py install

success!



      本文转自Jx战壕  51CTO博客,原文链接:http://blog.51cto.com/xujpxm/1734786,如需转载请自行联系原作者





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值