CentOS 编译安装 PyCrypto
转载自: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的更多相关文章
- CentOS编译安装NodeJS+Express
NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...
- Centos编译安装PHP 5.5笔记
本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...
- nginx php-fpm安装配置 CentOS编译安装php7.2
CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...
- CentOS编译安装nodejs
1. 从node.js官网下载最新版的node.js安装包,node.tar.gz wget https://nodejs.org/dist/v4.3.1/node-v4.3.1.tar.gz ...
- CentOS 编译安装 mysql
1.前期准备 1.1 环境说明: 操作系统: CentOS release 6.4 (Final) [查看命令 cat /etc/redhat-release ] mysql : mysql-5.6. ...
- CentOS编译安装lamp
LAMP环境搭建(编译安装CentOS+httpd2.2+mysql5.5+php5.4) 首先准备以下压缩包 <ignore_js_op> (1)编译安装apache 1.配置防火墙,开 ...
- CentOS编译安装Python3
前话 最近想学一下一门新的高级语言,无意中看到用python仿AIphaGo的github项目,就决定是他了. AIphaGo的Git传送门: https://github.com/Rochester ...
- CentOS编译安装LNMP环境
这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开 ...
- CentOS编译安装emacs并配置
Liunxs中CentOS系列一向以稳定为目标,然而也会存在版本太旧的问题,emacs就是其中的一个,目前emacs都发行到25.2了,而CentOS上的emacs版本却还是23.1.所以需要下载源代 ...
随机推荐
- vs2017项目上传到github
如果要把项目提交到一个厂库里面,需要建个git存储库,比如选择新建git库选择VSVIEW文件夹,以后在这个文件夹下的项目,提交时都会提交到VSVIEW这个github仓库 选择的文件夹不在git文件 ...
- linux 学习操作小计
屌丝最近在接触lamp开发 把工作中遇到的 问题和 一些常用的操作记下来.以便以后去翻阅 (1)linux下备份mysql数据库方法 #mysqldump -u root -p dbname > ...
- 怎么用wait、notify巧妙的设计一个Future模式?
我们知道多线程可以实现同时执行多个任务(只是看起来是同时,其实是CPU的时间片切换特别快我们没感觉而已). 现在假设一个做饭的场景,你没有厨具也没有食材.你可以去网上买一个厨具,但是这段时间,你不需要 ...
- PHP关于mb_substr不能起作用的问题
mb_substr不能起作用最大的原因是因为没有在php.ini文件没有把 ;extension=mbstring 前面的 :号去掉
- Java数据结构--单链表
#java学习经验总结------单链表的建立与结点的增删 在该链表结点有data数据,并且还有cpu,分给cpu随机的时间片,根据时间片大小进行结点data的排序 链表结点的建立 class Lin ...
- GPU体系架构(二):GPU存储体系
GPU是一个外围设备,本来是专门作为图形渲染使用的,但是随着其功能的越来越强大,GPU也逐渐成为继CPU之后的又一计算核心.但不同于CPU的架构设计,GPU的架构从一开始就更倾向于图形渲染和大规模数据 ...
- SpringCloud入门学习
我相信,如果小伙伴们能来到这里,肯定对微服务有一定的认识. 我们之前创建web项目的时候,常见的有两种方式: 1).创建一个war包,然后放在servlet容器中运行(比如Tomcat等); 2).使 ...
- 初学Python,需要装什么软件?
学习Python需要安装什么软件呢?也许你是一位编程小白,还不知道如何如何安装Python软件和开发环境.那么今天我们就来学一下关于Python软件.开发环境的相关知识,希望对你有用. 学Python ...
- java面对对象入门(4)-程序块初始化
Java实例初始化程序是在执行构造函数代码之前执行的代码块.每当我们创建一个新对象时,这些初始化程序就会运行. 1.实例初始化语法 用花括号创建实例初始化程序块.对象初始化语句写在括号内. publi ...
- Hystrix压测
背景介绍 JSF(京东服务框架,类似dubbo)默认配置了可伸缩的最大到200的工作线程池,每一个向外提供的服务都在其中运行(这里我们是服务端),这些服务内部调用外部依赖时(这里我们是客户端)一般是同 ...