编译可移植的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编译并不是 ...
随机推荐
- C# Using 开发随录
Using 关键字有2个主要用途: 1.做为语句 用于定义一个范围,在此范围的末尾将释放对象 2.做为指令 用于为命名空间创建别名或导入其他命名空间中定义的类型 C# 通过 .NET Framew ...
- linux进程管理(二)
接上[linux进程管理(一)] 终止进程的工具 kill .killall.pkill 终止一个进程或终止一个正在运行的程序,一般是通过 kill .killall.pkill.xkill 等进行. ...
- AcWing 143. 最大异或对
https://www.acwing.com/problem/content/145 #include <iostream> #include <algorithm> usin ...
- Zipper(动态规划)
点击打开链接 描述 Given three strings, you are to determine whether the third string can be formed by combin ...
- 【OCP 12c】最新CUUG OCP-071考试题库(62题)
62.(13-17)choose the best answer: You need to list the employees in DEPARTMENT_ID 30 in a single row ...
- jmeter服务器监控插件下载配置
jmeter想要监控服务器CPU.内存.磁盘.网络等相关资源需要借助plugins插件 下载jmeter性能监控插件 1.下载jmeterPlugins-Standard和jmeterPlugins- ...
- Spring 事务相关点整理
Spring和事务的关系 关系型数据库.某些消息队列等产品或中间件称为事务性资源,因为它们本身支持事务,也能够处理事务. Spring很显然不是事务性资源,但是它可以管理事务性资源,所以Spring和 ...
- 题目1006:ZOJ问题(字符串处理)
问题来源 http://ac.jobdu.com/problem.php?pid=1006 问题描述 输入一个只包含'z','o','j'三种字符的字符串,判断是否符合要求. 问题分析 分析AC的三个 ...
- QuantLib 金融计算——随机过程之 Heston 过程
目录 QuantLib 金融计算--随机过程之 Heston 过程 Heston 过程 参考文献 如果未做特别说明,文中的程序都是 Python3 代码. QuantLib 金融计算--随机过程之 H ...
- 【NOI2018】
总之国赛已经过了1个月了. 感谢北大当初给我的一本约救我狗命,不然国赛就要没学上了. 铜牌倒数十多名,我觉得我也是混到了一种境界. 虽然对于集训队已经失去梦想,但是,Day1全场堪称最低的21分,也是 ...