编译可移植的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编译并不是 ...
随机推荐
- Kubernetes 集群安装部署
etcd集群配置 master节点配置 1.安装kubernetes etcd [root@k8s ~]# yum -y install kubernetes-master etcd 2.配置 etc ...
- 深入了解java虚拟机(JVM) 第十一章 类的加载
一.类加载机制概述 虚拟机把描述类的数据从class文件加载到内存并对数据进行效验,解析和初始化,最终形成可以被虚拟机直接使用的java类型,这就是虚拟机的类加载机制. 二.类加载的机制 类加载的过程 ...
- objectARX 关于MFC类向导 无法向此非CCmdTarget派生类添加任何命令 的解决方式
objectARX 关于MFC类向导 无法向此非CCmdTarget派生类添加任何命令 的解决方式 图文By edata ,转载注明出处 http://www.cnblogs.com/edata 1 ...
- JMeterPlugin性能监控
GUI界面中的plugins manager中的jpgc-Standard set,其中共包含以下的文件: jpgc-dummy jpgc-fifo jpgc-graphs-basic jpgc-pe ...
- jmeter服务器监控插件指标简单说明
以下是下载了服务器监控插件的各个组件的功能介绍,有助于以后jmeter的性能测试 1.jp@gc - Actiive Threads Over Time:不同时间的活动用户数量展示(图表) 当前的时间 ...
- springboot自定义配置文件
前言:如果你一点spring的基础没有,建议你不要学习springboot,至少先有一个spring的项目经验或者自己搭建过spring的项目再学习springboot,这样你会发现在spring中搞 ...
- 阿里云服务器之hexo环境搭建
上一步主要主要讲解云服务器购买和连接云服务器,以及文件的操作.本文主要讲解利用hexo搭建自己的静态博客,在服务器中建立自己的hexo博客环境,最后达到可以远程访问,以及远程git推送到github. ...
- isUserAMonkey? android真逗
QA报了个问题,说是无线热点下面的开关都没了,看了看代码,原来这是android的保护机制. 在涉及到用户信息的功能上,android会通过ActivityManagerNative.isUserAM ...
- 4. C++11非受限联合体
在C/C++中,联合体是一种构造类型的数据结构.在一个联合体内,我们可以定义多种不同的数据类型,这些数据类型共享相同的内存空间,可以达到节省内存空间的目的. 1. 取消数据类型的限制 在C++98中, ...
- js 移动端获取当前用户的经纬度
一.HTML5 geolocation的属性 if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(onSuccess ...