编译可移植的python
1. 在低版本系统机器上,编译python:
cd Python-2.7.15/Modules
vim Setup.dist
修改下述代码:
###########
sed -i 's/#SSL=\/usr\/local\/ssl/SSL=\/usr\/local\/ansible_python\/openssl_for_python/g' Modules/Setup.dist
sed -i 's/#_ssl _ssl.c/_ssl _ssl.c/g' Modules/Setup.dist
sed -i 's/#\t-DUSE_SSL/\t-DUSE_SSL/g' Modules/Setup.dist
sed -i 's/#\t-L$(SSL)/\t-L$(SSL)/g' Modules/Setup.dist
sed -i 's/#_md5 md5module.c md5.c/_md5 md5module.c md5.c/g' Modules/Setup.dist
sed -i 's/#zlib zlibmodule.c/zlib zlibmodule.c/g' Modules/Setup.dist
sed -i 's/#binascii binascii.c/binascii binascii.c/g' Modules/Setup.dist
sed -i 's/#_sha1 sha1module.c/_sha1 sha1module.c/g' Modules/Setup.dist
sed -i 's/#_sha256 sha256module.c/_sha256 sha256module.c/g' Modules/Setup.dist
sed -i 's/#_sha512 sha512module.c/_sha512 sha512module.c/g' Modules/Setup.dist
############
2. 指定openssl库
编译新的openssl库
cd openssl-1.0.2o
./configure --prefix=/usr/local/ansible_python/openssl_for_python
make
make install
3. 由于python编译的时候需要去/usr/local/ssl/目录下寻找openssl库(具体可看setup.py),所以需要创建新编译openssl的软链接
ln -s /usr/local/ansible_python/openssl_for_python /usr/local/ssl
4. cd Python-2.7.15
./configure –prefix=/usr/local/ansible_python/python
make
make install
安装完成后,可以安装anshible等模块,方便移植
5. 将自己编译的openssl库放进系统共享库
echo “/usr/local/ansible_python/openssl_for_ansible/lib” >> /etc/ld.so.conf.d/ansible.conf
ldconfig
6. 压缩编译好的python和openssl,以便于移植
tar -cvjf ansible_python.tar.bz2 ansible_python
7. 将压缩包拷贝到新机器上/tmp目录后,解压 /tmp/ansible_python.tar.bz2
tar -xvjf /tmp/ansible_python.tar.bz2 得到 /tmp/ansible_python
8. 拷贝文件
cp -r /tmp/ansible_python /usr/local/ 9. 修改权限,使普通用户具有执行权限
chown -R ops:ops /usr/local/ansible_python/openssl_for_ansible/
chmod 755 /usr/local/ansible_python/python/bin/* 10. 创建指定的ssl库的软链
ln -s /usr/local/ansible_python/openssl_for_ansible/ /usr/local/ssl 11. 将指定的ssl库添加到系统共享库
echo “/usr/local/ansible_python/openssl_for_ansible/lib” >> /etc/ld.so.conf.d/ansible.conf 12. 执行命令
ldconfig
13. 此时新python已经可以使用
/usr/local/ansible_python/python/bin/python
编译可移植的python的更多相关文章
- 可移植的python环境
创建可移植的python环境 工作时使用的系统不联网,而且自带的python环境库不完整,每次干活都心累,所以想要做一个可移植的精简版的python环境. 开始前的准备: Ubuntu18.04 py ...
- Visual Studio 2013 编译 64 位 Python 的 C 扩展 (使用 PyObject 包装)
对于 32 位 Python 的 C 扩展,以前用过 mingW32 编译, 但是 mingW32 不支持 64 位 Python 的 C 扩展编译,详情可见 stackoverflow,这位前辈的大 ...
- Python3.6编译安装以及python开发之virtualenv与virtualenvwrapper
Python3.6编译安装 下载python源码包 先到安装目录 cd /opt 下载源码包 wget https://www.python.org/ftp/python/3.6.2/Python-3 ...
- Thrift编译与验证 - python
1 编译(保留了C和python语言,简化编译): # ./configure --without-java --without-cpp --without-php --without-erlang ...
- Ubuntu16.04下编译vim with python support失败的原因
- youcompleteme原话:On Ubuntu 16.04, Python support was not working due to enabling both Python2 and P ...
- (原+转)win7上编译caffe支持python及matlab
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/7126126.html 参考网址: https://github.com/happynear/caffe ...
- 安装YouCompleteMe时,编译依赖的python版本不对
启动vim打开文件时出错: The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library compile ...
- 如何编译和调试Python内核源码?
目录 写在前面 获取源代码 源代码的组织 windows下编译CPython 调试CPython 小结 参考 博客:blog.shinelee.me | 博客园 | CSDN 写在前面 如果对Pyth ...
- Opencv3.3(Linux)编译安装至python的坑
编译安装OpenCV绝对是一件让人发狂的事情,CMake繁多的选项,国内蛋疼的网速,实在让人无力吐槽,然而为了使用contrib包,我不得不重新编译他. OpenCV的编译 其实OpenCV编译并不是 ...
随机推荐
- WPF 新手引导
参考了https://www.cnblogs.com/ZXdeveloper/p/8391864.html,自己随便实现了一个,记录下,比较丑 <Window x:Class="Use ...
- windows server 2008 站点系列--AD的站点建立与子网的管理(zhuanzai)
本次课程将给大家介绍AD中站点和子网的功能.站点和子网之间的关联,以及相关的设置步骤. 应用背景介绍: contoso公司的总部在西安(Xian),陕南的汉中(Shannan)和陕北的榆林(Shanb ...
- java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
问题描述:在eclipse3.7中启动tomcat6时一直出现这个错误, java.lang.NoSuchMethodError: javax.servlet.ServletContext.getCo ...
- 当Shell遇上了NodeJS
此文已由作者尧飘海授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 摘要 在企业级系统维护和互联网运维中,Shell脚本的编写与维护常必不可少, 但是Shell脚本的编写与调试 ...
- soundPool的使用
SoundPool soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100); HashMap<Integer, Integer& ...
- 0基础浅谈反射型xss(2)
0x1:回顾前文疑惑“先闭合,在构造” 上一篇,我们说到了xss的一个触发精髓,“先闭合,在构造”,对于前面的先闭合,我们来简单的解释一下: 首先说,为什么要闭合? 因为HTML标签都是成对出现的 ...
- 查看npm安装包版本
npm list 版本号. eg: npm list socket.io
- (二)SSO之CAS框架单点退出,自定义退出界面.
用CAS的退出,只能使用它自己的那个退出界面,如果有这样的要求, 要求退出后自动跳转到登录界面, 该如何做呢?下面这篇文章实现了退出后可以自定义跳转界面. 用了CAS,发现退出真是个麻烦事,退出后跳 ...
- Java线程池学习心得
一.普通线程和线程池的对比 new Thread的弊端如下: a. 每次new Thread新建对象性能差.b. 线程缺乏统一管理,可能无限制新建线程,相互之间竞争,及可能占用过多系统资源导致死机或o ...
- web站点启用https (一)
HTTPS技术是现在主流网站都采用的安全加密传输数据的技术,本篇文档将分为2部分讲解PKI的基本原理及在web站点配置https访问. 一.理论知识 1.PKI(public key infrastr ...