本文共 1677 字,大约阅读时间需要 5 分钟。
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 |
解决办法有两个:
升级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,如需转载请自行联系原作者