解决 error: command 'swig' failed with exit status 1
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
# pip install docker-registry
分析:觀察出現(xiàn)的錯(cuò)誤,發(fā)現(xiàn)最開(kāi)始報(bào)錯(cuò)的地方提示不能找到openssl的.h頭文件。一般.h頭文件都是放到/usr/inclue目錄下的,而且頭文件所在的安裝包一般叫openssl-devel。
解決辦法:使用yum install openssl-devel安裝openssl的頭文件,成功后重新執(zhí)行pip install docker-registry。又出現(xiàn)了下面的錯(cuò)誤
??? 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.”
網(wǎng)上說(shuō)的,重新安裝m2crypto,先卸載系統(tǒng)中已經(jīng)安裝的m2crypto再用pip安裝的方法都是沒(méi)有用的。
解決辦法:這個(gè)提示大意是說(shuō)openssl-devel版本不適合你的系統(tǒng)架構(gòu),也就是x86的去找x86的頭文件,x86_64的去找x86_64文件,但現(xiàn)在是互相找不到對(duì)方。
查看一下安裝的文件是否x86和x64位的頭文件都有
# ls /usr/include/openssl/
opensslconf-x86_64.h ?opensslconf.h
文件都是存在的??匆幌履膫€(gè)文件報(bào)的錯(cuò),/usr/include/openssl/opensslconf.h:36,第36行報(bào)錯(cuò),打開(kāi)這個(gè)文件
| #include "opensslconf-sparc.h" #elif defined(__x86_64__) #include "opensslconf-x86_64.h"??? #原來(lái)是這樣寫的,說(shuō)明默認(rèn)去找x86_64位的頭文件 #else #error "This openssl-devel package does not work your architecture?" #endif ? #undef openssl_opensslconf_multilib_redirection_h |
默認(rèn)去找x86_64位的頭文件報(bào)了錯(cuò),那就說(shuō)明希望去找x86的文件了,修改方法如下
| #include "opensslconf-sparc.h" #elif defined(__x86_64__) #include "opensslconf-x86_64.h" #else #include "opensslconf.h"???? #去掉了原來(lái)的error提示,改成了安裝opensslconf.h文件。 #endif ? #undef openssl_opensslconf_multilib_redirection_h |
再次執(zhí)行pip install docker-registry
……
Successfully installed M2Crypto-0.22.3 docker-registry-0.9.1 sqlalchemy-0.9.4
問(wèn)題解決
轉(zhuǎn)載于:https://my.oschina.net/lionel45/blog/664017
總結(jié)
以上是生活随笔為你收集整理的解决 error: command 'swig' failed with exit status 1的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梦到母亲生孩子了是什么预兆
- 下一篇: hadoop 入门实例【转】