Centos系统下载大全 | Redhat系统下载大全 | Windows2012系统下载大全 | Windows2008系统下载大全| CMS教程 | 网站地图 51运维网-专注Linux/Unix系统安全运维!
当前位置:51运维网 > 教程 > Linux网络管理 > 正文

CentOS 编译安装 PyCrypto

时间:2016-07-02 01:00 来源:网络整理 作者:linux系统 阅读:


编译安装 PyCrypto




Step 1 - Install gcc/make

$ sudo yum install gcc $ sudo yum install make

That was easy.

Step 2 - Install the GNU MP Arithmetic Library

$ bunzip2 gmpbz2 $ cd gmp $ sudo ./configure $ sudo make $ sudo make check $ sudo make install $ cd

Still not too bad.

Step 3 - Install MPIR

$ bunzip mpirbz2 $ cd mpir $ sudo ./configure $ sudo make $ sudo make check $ sudo make install $ cd

Everything worked up through here.


There are two problems you’ll run into if you try to build PyCrypto at this point: errors from missing header files and, once you resolve those, runtime errors complaining about an undefined symbol for rpl_malloc. Let’s fix that.

Step 4 - Install the Python development headers

Easy fix.

Step 5 - Download PyCrypto

$ tar xzvf pycryptogz $ cd pycrypto-2.6

Step 6 - Edit the configure script

Find the this section of the script (I added line numbers):

:h :h h :

Keep line 3867, but comment out the rest. Save and exit.


The problem is that when you try to build PyCrypto, autotools thinks that we’re using rpl_malloc instead of malloc. I’m not sure how to fix this problem the right way, but this hack will get rid of the check and just have it use malloc. If someone knows the right way to fix this, please say something in the comments and I’ll update this post.


Step 7 - Build PyCrypto

$ python setup.py build $ sudo python

Step 8 - Test PyCrypto

$ python

If this works, you should be good to go.

If it fails, you did something wrong. You can either rm -r pycrypto-2.6 and re-extract the archive or just rm -r the build folder then grep for anything that says “rpl_malloc” and comment it out. Also edit config.status and change ‘D[“HAVE_MALLOC”]=” 0”’ to say ‘=” 1”’. This is what I did the first time, but when I decided to write this up I started over to try to get it right from the start.

Have fun.



感谢您对【51运维网 http://www.51ou.com/】的支持,我们为您免费提供《CentOS 编译安装 PyCrypto》技术文章,《CentOS 编译安装 PyCrypto》详细使用和说明,有时《CentOS 编译安装 PyCrypto》可能不完善、敬请谅解!如果《CentOS 编译安装 PyCrypto》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!