我正在尝试通过源代码编译在CentOS上安装M2Crypto。 我正在做一个python setup.py构建 但我收到以下错误,
/usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/local/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:28: Error: Unable to find 'openssl/opensslv.h'
SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
请告知......
人员Prasanna
答案 0 :(得分:10)
以下内容应该有效:
env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build
编辑:当然也需要openssl-devel
包。
答案 1 :(得分:7)
我刚遇到这个问题。在M2Crypto的INSTALL文件中:
Note about Fedora Core -based Distributions
----------------------------------------------------
Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.
我的解决方案是获取来源from PyPI或来自source。然后在M2Crypto目录中:
$ chmod +x fedora_setup.py
$ ./fedora_setup.py install
如果您正在使用virtualenv,请在该文件中更改python解释器的路径,或在构建之前激活您的环境。
我唯一对我的系统不满意的依赖是openssl-devel
。
答案 2 :(得分:4)
安装openssl-devel
。
答案 3 :(得分:0)
按照Brian的说明进行操作,并确保已安装openssl-devel
。如果你遇到这样的错误:
./fedora_setup.sh build
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf-i686.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf-i686.h'
error: command 'swig' failed with exit status 1
您正在64位硬件上运行i386操作系统。 arch =´uname -m´
会产生i686
。最简单的方法是解决这个问题,即创建一个符号链接。
sudo ln -s /usr/include/openssl/opensslconf-i386.h /usr/include/openssl/opensslconf-i686.h
或者,如果您遇到以下错误:
./fedora_setup.sh build
running build
running build_py
running build_ext
SWIG/_m2crypto_wrap.c:27555: error: ‘Swig_var__evp_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_get’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27576: error: ‘Swig_var__rsa_err_get’ undeclared (first use in this function)
...
缺少某些标头,只需发出以下命令,然后重试:
sudo yum install python-devel
答案 4 :(得分:0)
我现在遇到了这个问题(2018年),我通过安装openssl-devel
,gcc
和make
yum install gcc gcc-c++ make openssl-devel