当前位置: 首页>>技术教程>>正文


python – 如何在Ubuntu上安装M2Crypto?

, ,

问题描述

我正在尝试在Ubuntu 10.04 LTS上构建和安装M2Crypto。我下载并解压缩了M2Crypto-0.20.2.tar,并从M2Crypto-0.20.2目录中尝试了python setup.py build。我因为没有喝醉而出错。所以我跑了sudo apt-get install swig。然后我再次尝试了python setup.py build并得到:

/usr/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/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_bio.i:64: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_rand.i:19: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_evp.i:156: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_dh.i:36: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_rsa.i:43: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_dsa.i:31: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_ssl.i:207: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_x509.i:313: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_util.i:9: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_ec.i:111: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_engine.i:162: Warning(454): Setting a pointer/reference variable may leak memory.
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -I/usr/include -I/home/dspitzer/M2Crypto-0.20.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-i686-2.6/SWIG/_m2crypto_wrap.o -DTHREADING
SWIG/_m2crypto_wrap.c:126:20: error: Python.h: No such file or directory
SWIG/_m2crypto_wrap.c:757: error: expected ‘)’ before ‘*’ token
SWIG/_m2crypto_wrap.c:781: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

…等等。

有人成功做到了吗?

更新:我更改了标题,因为我没有想到M2Crypto将是预构建的Ubuntu软件包。

最佳方案

您可能需要安装python开发包:

sudo apt-get install python-dev

更好的是,不要麻烦自己构建m2crypto。作为完全受支持的软件包,它已经是in the Ubuntu repositories。这样,您将通过与Ubuntu系统其余部分相同的方式获得自动更新:

sudo apt-get install python-m2crypto

次佳方案

您是否安装了python2.6-dev软件包?这是包含您缺少的Python.h文件的软件包

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/10024.html,未经允许,请勿转载。