Pages

Tuesday, 3 November 2015

pycrypto的正确安装方法


pycrypto的安装:
wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
tar zxvf pycrypto-2.6.1.tar.gz
cd pycrypto-2.6.1
apt-get install -y libgmp-dev
(必须安装gmp.否则下面运行python setup.py install会遇到错误:
GMP or MPIR library not found。
如果你的vps系统为centos,则yum install gmp-devel)

错误-GMP or MPIR library not found的解决办法
https://bugs.launchpad.net/pycrypto/+bug/1179168
安装pycrypto的方法如下:
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar zxvf Python-2.7.10.tgz
cd Python-2.7.10
./configure --prefix=/usr/local/python-2.7.10 --enable-unicode=ucs4
make -j8
make install
建议把/usr/local/python-2.7.10/bin/python放入PATH environment variable。
cd ~
wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.7a1.tar.gz
tar zxvf pycrypto-2.7a1.tar.gz
cd pycrypto-2.7a1
/usr/local/python-2.7.10/bin/python setup.py install
这样即可成功安装pycrypto。