编译可移植的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编译并不是 ...
随机推荐
- 使用 pdf.js 查看发票时,显示不了台头和印章的解决办法
系统中使用了 pdf.js 来查看 PDF 文件,发现在查看 电子发票时, 缺失了很多信息, 刚开始以为是 PDF.JS 的 BUG, 后来调试发现只需要在 IIS 里添加一个 bcmap 后缀的 m ...
- TOJ1398正方形的编成 或者 POJ2362
#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> ...
- ADV拍卖
#include <stdio.h> int ren,wuping; int qian[20]; int wu1[20],wu2[20],wu3[20]; int a[20],visit[ ...
- java中数组的插入
package com.hxzy.demo; import java.util.Arrays;import java.util.Scanner; public class Demo1 { public ...
- 如何在WS系统的DOS命令台打印JAVA_HOME变量
echo %JAVA_HOME% 查看环境变量 path 新增临时环境变量 path D:\test;%path% 注意是反斜杆 cls 清空 F7 显示历史CMD指令
- Wannafly挑战赛26题解
为啥混进了几道不是魔禁的题--出题人太不敬业了-- 传送门 \(A\) 御坂网络 为啥没有番外个体和整体意志呢 暴力模拟就好了,这个要是都打错我干脆滚回去学文化课算了 //minamoto #incl ...
- 【css】—— inline-block 4px 和图片底部 2px bug
首先我们观察一组案例: HTML结构很简单: <!DOCTYPE html> <html lang="en"> <head> <meta ...
- day 28 :进程相关,进程池,锁,队列,生产者消费者模式
---恢复内容开始--- 前情提要: 一:进程Process 1:模块介绍 from multiprocessing import Process from multiprocessing impo ...
- django 运行报错汇总
记录自己在使用django开发过程中遇到的问题,不间断更新. (1) 独立运行普通Python脚本调用django中定义的类报错 报错信息: django.core.exceptions.Improp ...
- P4915 帕秋莉的魔导书
题目链接 题意分析 当前等级为\(x\)的魔法书会对等级在\([x,inf]\)的所有人造成\(y\)的影响 所以除了求平均值之外 就是区间修改区间求和 需要使用动态开点 + 标记永久化 需要注意的是 ...