Linux to install Python from the source under any path (non-site-packages)

Source: Internet
Author: User
Take Centos7 as an example:

Source installation python, usually first install some devel package:

Yum-y install XZ wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel

Then download the source code

Decompression Source:

TAR-JXF PYTHON.X.TAR.XZ

CD pyhton.x

./configure

Here are some options,--Bindir: The path where which Python is located after installation is complete

--prefix refers to the prefix of the path where Python is installed, such as: not Specified is/usr/local

When finished, generate the makefile file if direct./configure,python will be installed in

/usr/local/lib/python27 under

But what if I want to install it on any path?

Makefile has the following line, modify this can be

Libdest= $ (Scriptdir)/python$ (VERSION)

There is no time to overwrite the python that is installed with the operating system, because some of the infrastructure uses Python, for example: Yum

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.