安装m2crypto报错swig error : Unrecognized option -builtin
M2Crypto 是最完整的为 Python 包装 OpenSSL 的 RSA,DSA,DH,EC,HMACs,消息摘要,对称密码算法(包括AES)的一个库工具。
而自从 M2Crypto 升级到版本 0.22.5 后,用 pip install M2Crypto 命令来安装 M2Crypto 时总是会失败。
在没有升级到此版本之前,使用 pip 安装则是没有问题的。下面来找找原因。
系统环境:CentOS 6.7 x86
失败关键字:swig
失败现象:
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 error : Unrecognized option -builtin
这说明,系统里安装的 swig 是没有 -builtin 这个选项的。来看看系统装的 swig 版本。
rpm -qa | grep swig
返回:
swig-1.3.40-6.el6.i686
是不是版本比较旧的缘故导致的呢?再来看看 swig 的帮助。
swig -help
看到其中有:
Note: ‘swig -<lang> -help’ displays options for a specific target language.
因为是涉及到 Python,换个命令来看看。
swig -python -help
返回(节选):
-buildnone – Use Py_BuildValue() to obtain Py_None (default in Windows)
注意其中的 options,果然是没有 -builtin 这个选项的。
好吧很明显,安装 M2Crypto 所依赖的 swig 版本升级了,而 CentOS 默认的 swig 版本过低了。
下面来升级 swig 版本。官网最新版已经到了 3.0.7 了,就编译安装此版本的。
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
安装完成后,再来看一下版本号。
swig -version
返回:
SWIG Version 3.0.7
至此,升级 swig 完成。再来看看新版本的 swig 到底有没有 -builtin 这个选项。
swig -python -help
返回(节选):
-buildnone – Use Py_BuildValue() to obtain Py_None (default in Windows)
-builtin – Create new python built-in types, rather than proxy classes, for better performance
果然如此。既然如此,那赶紧继续用 pip 安装 M2Crypto 吧。
pip install M2Crypto
Boom,又出错了。错误信息如下:
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
/usr/include/openssl/opensslconf.h:13: Error: Unable to find 'opensslconf-i386.h'
error: command 'swig' failed with exit status 1
原因是什么呢?M2Crypto 没找到 openssl 的头文件 opensslconf-i386.h
如果是在 x86_64 下安装的话,会找不到 opensslconf-x86_64.h
怎么办呢?看来是不能通过 pip 来安装了,那我们手动来。
wget --no-check-certificate -O M2Crypto-0.22.5.tar.gz https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.5.tar.gz
tar zxf M2Crypto-0.22.5.tar.gz
cd M2Crypto-0.22.5
cp /usr/include/openssl/opensslconf-i386.h ./ #手动把头文件复制过来(适用于x86)
cp /usr/include/openssl/opensslconf-x86_64.h ./ #手动把头文件复制过来(适用于x86_64)
python setup.py install
好了,这下终于安装完成了。看看成果:
pip list | grep M2Crypto
返回:
M2Crypto (0.22.5)
后来我去到 M2Crypto 的官网去看了下,已经有人跟作者反映了这个事情。
https://gitlab.com/m2crypto/m2crypto/issues/69
希望作者能在下个版本改进吧。
原文链接:解决pip安装M2Crypto失败的问题
安装m2crypto报错swig error : Unrecognized option -builtin的更多相关文章
- 安装 R 包报错 clang: error: unsupported option '-fopenmp' 的解决方法
MacOS 上安装 R 包 install.packages("data.table") 后面提示是否安装需要编译的版本: Do you want to install from ...
- 一个参数大小写引发的uploadify报错 "Syntax error, unrecognized expression: #"
上传控件uploadify 报错"Syntax error, unrecognized expression: #" 版本为 uploadify3.2 报错原因:参数ID[hi ...
- linux下安装php报错configure: error: Cannot find MySQL header files under /usr/include/mysql.
linux下安装php报错configure: error: Cannot find MySQL header files under /usr/include/mysql. 2013-03-04 1 ...
- 关于mac安装rails报错clang: error: unknown argument
文章都是从我的个人博客上转载过来的,大家可以点击我的个人博客. www.iwangzheng.com mac上安装rails的时候报错, 安装rails的在终端执行了一句命令: $sudo gem i ...
- pip安装lxml报错 Fatal error in launcher: Unable to create process using '"c:\users\administrator\appdata\local\programs\python\python36\python.exe" "C:\Users\Administrator\AppData\L
pip install lxml 安装报错 E:\apollo\spider_code>Fatal error in launcher: Unable to create process usi ...
- php 安装imap报错“configure: error: utf8_mime2text() has new signature”解决
环境:php官方docker镜像 php:7.2-apache 安装IMAP扩展模块执行命令:docker-php-ext-install imap 报错信息:configure: error: ut ...
- 安装zabbix报错configure: error: libcurl library not found
libcurl 和libcurl-devel都已经安装 且大于7.13.1 但还是报错,这时需要在configure 指定curl路径即可 ./configure --prefix=/usr/loca ...
- windows 安装docker报错:Error checking TLS connection: ssh command error: command : ip addr show
今天安装docker部署的时候总是再报这个错误. 报错的原因是初始化的时候出错了. 在docker 安装目录下有一个文件,如下图所示 将它复制到你电脑用户名目录下生成.docker 的文件夹中,如下图 ...
- 解决Android Studio编译后安装apk报错:Error while Installing APK
刚开始玩 Android ,用Android studio 连接真机做测试,在虚拟机上没有问题,但是真机就会报错 检查了好多地方,最终发现了问题,网上的常规就不介绍了,大家自己去看别的帖子 手机方面 ...
随机推荐
- android自定义控件(3)-自定义当前按钮属性
那么还是针对我们之前写的自定义控件:开关按钮为例来说,在之前的基础上,我们来看看有哪些属性是可以自定义的:按钮的背景图片,按钮的滑块图片,和按钮的状态(是开还是关),实际上都应该是可以在xml文件中直 ...
- 网上搜的一个shell中 中文设置的一个样例;
from:http://www.cnblogs.com/52linux/archive/2012/03/24/2415082.html SSH Secure Shell Client中文乱码的解决方法 ...
- hdu4970 Killing Monsters (差分数列)
2014多校9 1011 http://acm.hdu.edu.cn/showproblem.php?pid=4970 Killing Monsters Time Limit: 2000/1000 M ...
- "当前方法的代码已经过优化,无法计算表达式的值"的这个错误的解决方案!!!
http://blog.useasp.net/archive/2012/09/12/how-to-debug-dotnet-framework-source-when-throw-the-code-o ...
- 未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”中加载类型“System.ServiceModel.Activation.HttpModule”。
********************************* 思路壹(也是网络上铺天盖地的通俗解决方案) 原因: 这是因为先安装了 .NET Framework , 随后启用了 .NET Fra ...
- POJ 1265 Area
有一种定理,叫毕克定理.... Area Time Limit: 1000MS Memory Limit: 10000K Total Sub ...
- 2015baidu复赛2 连接的管道(mst && 优先队列prim)
连接的管道 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- Mac 命令
1.du 获取某个目录下各个文件和子目录占用多少空间,可以输入:du -sh *
- 开关WIFI脚本
title wifi管理color A@echo on@echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@echo 1.启用并设定虚拟WiFi网卡;@echo 2.开启无线网络; ...
- Ehcache与Guava Cache的区别浅谈
最近在做一些缓存改造的场景,有如下一些经验总结: 缓存版本: Ehcache:2.8.3 Guava:17.0 Ehcache支持持久化到本地磁盘,Guava不可以: Ehcache有现成的集群解决方 ...