转载自:http://bugcharmer.blogspot.com/2012/07/building-pycrypto-on-amazon-ec2.html

Step 1 - Install gcc/make

$ sudo yum install gcc
$ sudo yum install make

That was easy.

Step 2 - Install the GNU MP Arithmetic Library

$ wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2
$ bunzip2 gmp-5.0.5.tar.bz2
$ cd gmp-5.0.5
$ sudo ./configure
$ sudo make
$ sudo make check
$ sudo make install
$ cd

Still not too bad.

Step 3 - Install MPIR

$ wget http://www.mpir.org/mpir-2.5.1.tar.bz2
$ bunzip mpir-2.5.1.tar.bz2
$ cd mpir-2.5.1
$ sudo ./configure
$ sudo make
$ sudo make check
$ sudo make install 
$ cd

Everything worked up through here.

Intermission

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

$ sudo yum install python-devel

Easy fix.

Step 5 - Download PyCrypto

$ wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz 
$ tar xzvf pycrypto-2.6.tar.gz
$ cd pycrypto-2.6

Step 6 - Edit the Env

$ export ac_cv_func_malloc_0_nonnull=yes

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.

否则会有如下错误:

ImportError: /usr/local/lib/python2.6/dist-packages/pycrypto-2.6-py2.6-linux-x86_64.egg/Crypto/Cipher/_AES.so: undefined symbol: rpl_malloc

Step 7 - Build PyCrypto

$ python setup.py build
$ sudo python setup.py install

Step 8 - Test PyCrypto

$ python
>>> from Crypto.Cipher import AES

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.

CentOS 编译安装 PyCrypto的更多相关文章

  1. CentOS编译安装NodeJS+Express

    NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...

  2. Centos编译安装PHP 5.5笔记

    本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...

  3. nginx php-fpm安装配置 CentOS编译安装php7.2

    CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...

  4. CentOS编译安装nodejs

    1. 从node.js官网下载最新版的node.js安装包,node.tar.gz wget https://nodejs.org/dist/v4.3.1/node-v4.3.1.tar.gz    ...

  5. CentOS 编译安装 mysql

    1.前期准备 1.1 环境说明: 操作系统: CentOS release 6.4 (Final) [查看命令 cat /etc/redhat-release ] mysql : mysql-5.6. ...

  6. CentOS编译安装lamp

    LAMP环境搭建(编译安装CentOS+httpd2.2+mysql5.5+php5.4) 首先准备以下压缩包 <ignore_js_op> (1)编译安装apache 1.配置防火墙,开 ...

  7. CentOS编译安装Python3

    前话 最近想学一下一门新的高级语言,无意中看到用python仿AIphaGo的github项目,就决定是他了. AIphaGo的Git传送门: https://github.com/Rochester ...

  8. CentOS编译安装LNMP环境

    这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开 ...

  9. CentOS编译安装emacs并配置

    Liunxs中CentOS系列一向以稳定为目标,然而也会存在版本太旧的问题,emacs就是其中的一个,目前emacs都发行到25.2了,而CentOS上的emacs版本却还是23.1.所以需要下载源代 ...

随机推荐

  1. CCF_ 201409-3_字符串匹配

    水. #include<cstdio> #include<iostream> #include<cstring> using namespace std; int ...

  2. .Net Core中IOC容器的使用

    打代码之前先说一下几个概念,那就是什么是IOC.DI.DIP 虽然网上讲这些的已经有很多了,我这里还是要再赘述一下 IOC容器就是一个工厂,负责创建对象的 IOC控制反转:只是把上端对下端的依赖,换成 ...

  3. ASP.NET MVC5+EF6+EasyUI 后台管理系统--网页版本代码生成器

    1.单列表模式 2.树形列表模式 3.左右列表模式 4.左右树形和列表结合模式 一 简介 网页版代码生成器需要运行项目,非常有趣,可以用来研究,和自定义一些自己的代码习惯 按界面生成:可生成单个页面和 ...

  4. Java TreeSet的使用

    1.TreeSe自带排序的set,没有重复元素. 2.TreeSet 如果构造函数中没有使用比较器,那在装载的对象类中要实现Comparable 接口. 3.TreeSet 使用初始化比较器的方式. ...

  5. 保留yum安装的软件包

    文件路径 /etc/yum.conf [root@opvnserver ~]# grep "keepcache" /etc/yum.conf keepcache=0 [root@o ...

  6. CentOS 7中安装 MySQL 出现了 No package mysql-server available. Error: Nothing to do 错误

     CentOS 7 安装 mysql-server 爬坑  发现问题 在centos 6安装 mysql-server是直接使用命令 yum -y install mysql-server ,但是在C ...

  7. cornerstone使用beyond compare比较工具

    prefrences->general->external compare tool->open script foder 新建一个bc.sh文件(名字可以任意,sh后缀即可)保存到 ...

  8. leetcode--js--Two Sum

    问题描述: 给定一个整数数列,找出其中和为特定值的那两个数. 你可以假设每个输入都只会有一种答案,同样的元素不能被重用. 示例: 给定 nums = [2, 7, 11, 15], target = ...

  9. redis_入门

    Redis_day01 1. NoSql 1.1 NoSql是什么 NoSQL(不仅仅是SQL not only SQL),泛指非关系型的数据库.随着互联网web2.0网站的兴起,传统的关系数据库在处 ...

  10. NServiceBus 入门到精通(一)

    什么是NServiceBus?NServiceBus 是一个用于构建企业级 .NET系统的开源通讯框架.它在消息发布/订阅支持.工作流集成和高度可扩展性等方面表现优异,因此是很多分布式系统基础平台的理 ...