【问题标题】:Installing M2Crypto on CentOS在 CentOS 上安装 M2Crypto
【发布时间】:2010-12-07 18:26:42
【问题描述】:

我正在尝试通过从源代码编译在 CentOS 上安装 M2Crypto。 我正在做一个 python setup.py build 但是我收到以下错误,

/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

请指教……

大意

【问题讨论】:

  • 你为什么这样做? m2crypto 打包在 RHEL 6 中。你有哪个版本的 CentOS?

标签: python installation m2crypto


【解决方案1】:

以下应该有效:

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

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

【讨论】:

  • /usr/local/lib/python2.6/distutils/dist.py:266:UserWarning:未知的分发选项:'test_suite'warnings.warn(msg) running build running build_py running build_ext building' M2Crypto.__m2crypto' 扩展 SWIG/_m2crypto.i 到 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: 错误: 无法找到 'openssl/opensslv.h' SWIG/_evp.i:9: 错误: 无法找到'openssl/opensslconf.h' SWIG/_ec.i:7:错误:找不到“openssl/opensslconf.h”
  • 我不知道我必须使用这个命令来完成安装......而且我正在以任何其他用户的身份运行这个命令......确保当你从源代码安装东西时......你应该以 root 身份登录 .. 非常感谢这个命令的“方丈”
【解决方案2】:

我刚遇到这个问题。在 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.

我的解决方案是从from PyPIsource 获取源代码。然后在M2Crypto目录下:

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

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

我的系统唯一不满意的依赖是openssl-devel

【讨论】:

  • fedora_setup.py 还是 fedora_setup.sh?我刚刚下载的源代码(2012 年 9 月 17 日)有 .sh 文件,没有 .py 文件。
  • 查看 INSTALL 中是否显示任何内容。只需按照那里的说明进行操作即可。
【解决方案3】:

安装openssl-devel

【讨论】:

  • 假设你这样做:$> updatedb& $> locate openssl 你能在你的系统上找到丢失的标题吗?
  • 我从来没有用过updatedb。不过我试过了,它给了我一个错误,updatedb: can't open a temporary file for `/var/lib/mlocate/mlocate.db' 我一直在使用 yum 和 rpm .. 我怎样才能找到丢失的标题?
  • 实际上我安装了 openssl 并且缺少 devel ......谢谢 Ignacio ..这个建议解决了我的部分问题
  • 有谁知道对应的Ubuntu包吗?
  • @JoeJ:我相信是libssl-dev
【解决方案4】:

按照布赖恩的指示,确保您已安装 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

【讨论】:

    【解决方案5】:

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

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

    【讨论】:

      猜你喜欢
      • 2014-05-11
      • 2013-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-13
      相关资源
      最近更新 更多