Install python from source code to any path under Linux (non-site-packages)

高洛峰
Release: 2017-03-28 16:51:45
Original
2263 people have browsed it

Take centos7 as an example:

To install python from the source code, generally install some devel packages first:

yum -y install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib -devel bzip2-devel

Then download the source code

Unzip the source code:

tar -Jxf Python.x.tar.xz

cd Pyhton .x

./configure

There are some options here, --bindir: the path where python is located after the installation is complete

--prefix refers to the installation of python The prefix of the path, for example: If not specified, it will be /usr/local

After completion, the Makefile file will be generated. If you directly ./configure, python will be installed in

/usr/ Under local/lib/python27

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

Makefile has the following line, just modify this

LIBDEST= $ (SCRIPTDIR)/python$(VERSION)

Do not overwrite the installation of python that comes with the operating system at any time, because some infrastructure uses python, such as: yum

The above is the detailed content of Install python from source code to any path under Linux (non-site-packages). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template