Compiling portable Python

Source: Internet
Author: User
Tags openssl library

1On the low-version system machine, compile the PYTHON:CD Python-2.7.15/Modules Vim setup.dist Modify the following code:###########Sed-i's/#SSL =\/usr\/local\/ssl/ssl=\/usr\/local\/ansible_python\/openssl_for_python/g'modules/setup.distsed-I.'s/#_ssl _ssl.c/_ssl _ssl.c/g'modules/setup.distsed-I.'s/#\t-duse_ssl/\t-duse_ssl/g'modules/setup.distsed-I.'s/#\t-l$ (SSL)/\t-l$ (SSL)/g'modules/setup.distsed-I.'s/#_md5 md5module.c md5.c/_md5 md5module.c md5.c/g'modules/setup.distsed-I.'s/#zlib zlibmodule.c/zlib zlibmodule.c/g'modules/setup.distsed-I.'s/#binascii binascii.c/binascii binascii.c/g'modules/setup.distsed-I.'s/#_sha1 sha1module.c/_sha1 sha1module.c/g'modules/setup.distsed-I.'s/#_sha256 sha256module.c/_sha256 sha256module.c/g'modules/setup.distsed-I.'s/#_sha512 sha512module.c/_sha512 sha512module.c/g'modules/setup.dist############2. Specify the OpenSSL library to compile the new OpenSSL library CD OpenSSL-1.0. 2o./configure--prefix=/usr/local/ansible_python/Openssl_for_python make make install3. As Python compiles, you need to go to/usr/local/ssl/directory to find the OpenSSL library (see setup.py), so you need to create a new soft link to compile OpenSSL ln-s/usr/local/ansible_python/openssl_for_python/usr/local/SSL4. CD Python-2.7.15  ./configure–prefix=/usr/local/ansible_python/once the python make makes install is installed, you can install modules such as anshible for easy porting5. Put your own built-in OpenSSL library into the system shared library echo "/usr/local/ansible_python/openssl_for_ansible/lib ">>/etc/ld.so.conf.d/ansible.conf
Ldconfig6. Compress the compiled Python and OpenSSL to facilitate porting the tar-CVJF ansible_python.tar.bz2 Ansible_python7. After copying the compressed package to the/tmp directory on the new machine, unzip the/tmp/Ansible_python.tar.bz2tar-XVJF/TMP/ANSIBLE_PYTHON.TAR.BZ2 Get/tmp/Ansible_python8. copy file CP-r/tmp/ansible_python/usr/local/9. Modify permissions so that normal users have Execute permissions chown-R ops:ops/usr/local/ansible_python/openssl_for_ansible/chmod755/usr/local/ansible_python/python/bin/*10create a soft-chain LN for the specified SSL library.-s/usr/local/ansible_python/openssl_for_ansible//usr/local/SSL11. Add the specified SSL library to the system shared library echo "/usr/local/ansible_python/openssl_for_ansible/lib ">>/etc/ld.so.conf.d/ansible.conf12. Execute command ldconfig13. Now that the new Python is ready to use/usr/local/ansible_python/python/bin/python

Compiling portable Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.