如何在Ubuntu上安装M2Crypto?

时间:2010-06-24 03:25:19

标签: python ubuntu m2crypto

我正在尝试在Ubuntu 10.04 LTS上构建和安装M2Crypto。我下载并解压缩了M2Crypto-0.20.2.tar,并从M2Crypto-0.20.2目录中尝试python setup.py build。我收到错误,因为我没有swig。所以我跑了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软件包。

3 个答案:

答案 0 :(得分:27)

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

sudo apt-get install python-dev

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

sudo apt-get install python-m2crypto

答案 1 :(得分:3)

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

答案 2 :(得分:0)

也许有人会遇到与openssl相关的错误,请尝试以下操作:

sudo apt-get install openssl
sudo apt-get install libssl-dev