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.所以需要下载源代 ...
随机推荐
- CCF_ 201512-2_消除类游戏
水平方向遍历一次,竖直方向遍历一次,将需要删除的位置标志入一个数组,最后比较输出即可. #include<cstdio> #include<iostream> using na ...
- re模块 常用函数
1. findall() 函数 find('正则表达式',‘待匹配的字符串’) #返回匹配到字符串,并存放在列表中 详解见:https://www.cnblogs.com/nbk-zyc/p/1111 ...
- (三)maven创建部署javaweb
http://how2j.cn/k/idea/idea-maven-web/1356.html#nowhere 这个网站讲的很详细了,下载很慢的话按照他的提示配置阿里云即可,很快 另外可能会出现各种j ...
- [信息安全] 05 X.509 公钥证书的格式标准
X.509是# 公钥证书的格式标准, 广泛用于TLS/SSL安全通信或者其他需要认证的环境中.X.509证书可以由# CA颁发,也可以自签名产生. 1 Overview {#1-overview} X ...
- Go语言实现:【剑指offer】数组中只出现一次的数字
该题目来源于牛客网<剑指offer>专题. 一个整型数组里除了两个数字之外,其他的数字都出现了两次.请写程序找出这两个只出现一次的数字. 正常能想到哈希表来处理,但此题考查的是异或的知识, ...
- LeetCode 126. Word Ladder II 单词接龙 II(C++/Java)
题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transfo ...
- CP - OFDM
- ubuntu下怎么配置/查看串口-minicom工具
一.安装minicom工具: 可直接使用命令sudo apt-get install minicom来完成安装 上面的截图因为检测到我已经安装过了. 二.通过minicom工具配置串口: 1.启动mi ...
- ELK(V7)部署与架构分析
1.ELK的背景介绍与应用场景 在项目应用运行的过程中,往往会产生大量的日志,我们往往需要根据日志来定位分析我们的服务器项目运行情况与BUG产生位置.一般情况下直接在日志文件中tailf. grep. ...
- 杭电-------2053Switch Game(C语言)
/* 题目大意是指:有n个灯泡,按1-n编号,要操作n次,第i次操作是将标号是i的倍数的变成相反状态.最终求得是n次操作后,编号为n的灯泡的状态,其实就是求n的约束有多少个,及灯泡n被操作了多少次*/ ...