解决 error: command 'swig' failed with exit status 1

# pip install docker-registry


分析:观察出现的错误,发现最开始报错的地方提示不能找到openssl.h头文件。一般.h头文件都是放到/usr/inclue目录下的,而且头文件所在的安装包一般叫openssl-devel

解决办法:使用yum install openssl-devel安装openssl的头文件,成功后重新执行pip install docker-registry。又出现了下面的错误

    running build_ext
    building 'M2Crypto.__m2crypto' extension
    swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
    swig -python -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -includeall -modern -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    /usr/include/openssl/opensslconf.h:36: 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

即“/usr/include/openssl/opensslconf.h:36: Error: CPP #error ""This openssl-devel package does not work your architecture?"". Use the -cpperraswarn option to continue swig processing.

网上说的,重新安装m2crypto,先卸载系统中已经安装的m2crypto再用pip安装的方法都是没有用的。

解决办法:这个提示大意是说openssl-devel版本不适合你的系统架构,也就是x86的去找x86的头文件,x86_64的去找x86_64文件,但现在是互相找不到对方。

查看一下安装的文件是否x86x64位的头文件都有

# ls /usr/include/openssl/

opensslconf-x86_64.h  opensslconf.h

文件都是存在的。看一下哪个文件报的错,/usr/include/openssl/opensslconf.h:36,第36行报错,打开这个文件

#include "opensslconf-sparc.h"

#elif defined(__x86_64__)

#include "opensslconf-x86_64.h"    #原来是这样写的,说明默认去找x86_64位的头文件

#else

#error "This openssl-devel package does not work your architecture?"

#endif

 

#undef openssl_opensslconf_multilib_redirection_h

默认去找x86_64位的头文件报了错,那就说明希望去找x86的文件了,修改方法如下

#include "opensslconf-sparc.h"

#elif defined(__x86_64__)

#include "opensslconf-x86_64.h"

#else

#include "opensslconf.h"     #去掉了原来的error提示,改成了安装opensslconf.h文件。

#endif

 

#undef openssl_opensslconf_multilib_redirection_h

再次执行pip install docker-registry

……

Successfully installed M2Crypto-0.22.3 docker-registry-0.9.1 sqlalchemy-0.9.4

问题解决

转载于:https://my.oschina.net/lionel45/blog/664017

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值