19

我正在尝试在 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 包。

4

3 回答 3

30

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

sudo apt-get install python-dev

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

sudo apt-get install python-m2crypto
于 2010-06-24T04:03:02.613 回答
3

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

于 2010-06-24T03:44:48.013 回答
1

也许有人会得到与openssl相关的错误,试试这个:

sudo apt-get install openssl
sudo apt-get install libssl-dev
于 2019-06-24T16:00:11.887 回答