在 CentOS 上安装 M2Crypto

发布于 2024-10-06 11:25:45 字数 753 浏览 4 评论 0原文

我正在尝试通过从源代码编译来在 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

I am trying to install M2Crypto on CentOS by compiling from the source.
i am doing a python setup.py build
But I get the following error,

/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

Please advise ...

Prasanna

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

此生挚爱伱 2024-10-13 11:25:45

以下内容应该有效:

env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build

编辑:当然还需要 openssl-devel 包。

The following should work:

env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build

Edit: and openssl-devel package is of course also required.

哎呦我呸! 2024-10-13 11:25:45

我刚刚遇到这个问题。在 M2Crypto 的安装文件中:

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.

我的解决方案是获取源 来自 PyPI 或来自来源。然后在 M2Crypto 目录中:

$ chmod +x fedora_setup.py
$ ./fedora_setup.py install

如果您使用的是 virtualenv,请更改该文件中 python 解释器的路径,或者在构建之前激活您的环境。

我的系统上唯一不满足的依赖项是openssl-devel。

I just had this problem. In M2Crypto's INSTALL file:

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.

My solution was to get the sources from PyPI or from the source. Then in the M2Crypto directory:

$ chmod +x fedora_setup.py
$ ./fedora_setup.py install

If you're using a virtualenv, change the path of the python interpreter in that file, or activate your environment before building.

The only dependency that I had that wasn't satisfied on my system was openssl-devel.

尤怨 2024-10-13 11:25:45

安装openssl-devel。

Install openssl-devel.

方觉久 2024-10-13 11:25:45

按照 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

Follow Brian's instruction, and make sure you have install openssl-devel. if you experience error like this:

./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

You are running i386 operating system on 64 bit hardware. arch =´uname -m´ will yields i686. The easiest way is to work around this is to create a symbolic link.

sudo ln -s /usr/include/openssl/opensslconf-i386.h /usr/include/openssl/opensslconf-i686.h

Or if you experience errors like:

./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)
...

Some headers are missing, just issue the following command and try again:

sudo yum install python-devel
故人如初 2024-10-13 11:25:45

我现在(2018年)遇到了这个问题,我通过安装 openssl-develgccmake

yum install gcc gcc 解决了它-c++ make openssl-devel

I had this problem now (in 2018), I solved it by installing openssl-devel, gcc and make

yum install gcc gcc-c++ make openssl-devel

碍人泪离人颜 2024-10-13 11:25:45

这适用于 RHEL 8.7,也可能适用于 CentOS 8

pip install swig wheel M2Crypto
yum -y install gcc gcc-c++ make openssl-devel python3-devel 

This worked for RHEL 8.7 and will all probably work CentOS 8

pip install swig wheel M2Crypto
yum -y install gcc gcc-c++ make openssl-devel python3-devel 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文