1

我无法在 Ubuntu 10.04 LTS 上安装最新的 Python Crypto 模块。我删除了旧的 2.0.1 Crypto 版本sudo apt-get remove python-crypto并继续安装 2.6 版本。

我下载了最新的 Crypto zip 并运行安装程序sudo python setup.py install,但我得到:

running install  
running build  
running build_py  
running build_ext  
running build_configure  
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.  
building 'Crypto.Cipher._AESNI' extension  
gcc -std=gnu99 -fno-strict-aliasing -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -fPIC -Isrc/ -I/usr/include/python2.6 -c src/AESNI.c -o build/temp.linux-i686-2.6/src/AESNI.o -maes
In file included from /usr/lib/gcc/i486-linux-gnu/4.4.3/include/wmmintrin.h:31,
                 from src/AESNI.c:26:  
/usr/lib/gcc/i486-linux-gnu/4.4.3/include/emmintrin.h: In function \u2018aes128_keyexpand\u2019:  
/usr/lib/gcc/i486-linux-gnu/4.4.3/include/emmintrin.h:1380: error: the last argument must be an 8-bit immediate  
error: command 'gcc' failed with exit status 1  

我安装了python-dev,但是没有效果。

apt-get install python-crypto只需安装 Crypto 2.0.1。

我的 Python 版本是 2.6.5。

4

1 回答 1

0

If you have i.e.

deb-src http://archive.ubuntu.com/ubuntu quantal main

in your /etc/apt/sources.list then You don't need to download zip file you can download source using apt-get source like;

apt-get install debhelper
apt-get source python-crypto
apt-get build-dep python-crypto

tar xvf python-crypto*debian*tar.gz
cd python-crypto*
debian/rules binary

You can modify your debian/rules file to add custom flags if you need before run

debian/rules binary

After build is complete you can install packages using

dpkg -i *.deb

It's also possible that your distro version doesn't meet requirements for installing latest vesion of python-crypto.

于 2013-06-20T11:47:54.033 回答