Detailed tutorial on compiling and installing python3.6 on linux

Detailed tutorial on compiling and installing python3.6 on linux

1. First go to the official website https://www.python.org/downloads/source/ and download the Gzipped source tarball

Do not download " XZ compressed source tarball ". The latest version of Python 3.6 is named Python-3.6.7.tgz. Put the downloaded compressed package anywhere, or put it on the desktop (to facilitate deletion of the installation package and the unzipped installation package after installation).

2. Switch the command line to the directory where the compressed file is located (such as the desktop), and then enter tar -xzf Python-3.6.7.tgz

Here, tar means decompression, -x means extracting files from the archive file, z means decompressing with gzip (for compressed packages in xx.tgz and xx.tar.gz formats), and f is followed by the compressed file name.

3. Switch the command line directory to the unzipped folder, which is the Python-3.6.7 folder. Then execute ./configure .

The function of this command is to generate a Makefile file for use by the next make command. The Makefile file stores the build order. When building program components in linux, you need to follow the order specified by the Makefile.

4. Run make

The function of make is to mutate the source code and generate executable files.

Execute make install

make install copies the generated executable files to the necessary directory in the Linux system, such as the usr/local/bin directory, so that all users can run the program.

So far, the installation of Python is complete. The installation of other Linux software is similar, basically the process of configure>make>make install.

Execute which python to view the installation directory of Python. The python that comes with linux and the python we installed are both stored in this directory. However, when we enter python in the command line, we find that the old version of python that comes with Linux is still entered. If we want to enter the new version of python, we need to enter python3 in the command line.

Check whether the installation is successful: enter python3, enter shell mode, and enter a line of code:

print ("Hello World")

Will output the string content.

To view the installation location: Enter the shell and enter

import sys
print(sys.path)

Summarize

The above is a detailed tutorial on how to compile and install python 3.6 on linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Analysis of the principles and characteristics of Python's commonly used compilers
  • Detailed explanation of the difference between Python compiler and interpreter
  • A brief discussion on python compilation pyc project--solution of import package problem
  • Does Python program need to be compiled?

<<:  MySQL creates users, authorizes users, revokes user permissions, changes user passwords, and deletes users (practical tips)

>>:  How to use rem adaptation in Vue

Recommend

Tutorial on migrating mysql from phpstudy to Linux

Project Purpose Migrate the data in MySQL 5.5.53 ...

Detailed explanation of the usage of DECIMAL in MySQL data type

Detailed explanation of the usage of DECIMAL in M...

How to add sudo permissions to a user in Linux environment

sudo configuration file The default configuration...

Summary of using the reduce() method in JS

Table of contents 1. Grammar 2. Examples 3. Other...

Two simple ways to remove text watermarks from web pages

<br /> When we browse certain websites and s...

Example of how to enable Slow query in MySQL

Preface Slow query log is a very important functi...

Detailed explanation of the WeChat applet request pre-processing method

question Because some of our pages request data i...

Solution to the garbled code problem in MySQL 5.x

MySQL is a commonly used open source database sof...

How to expand the disk size of a virtual machine

After Vmvare sets the disk size of the virtual ma...

Solution to the problem of eight hours difference in MySQL insertion time

Solve the problem of eight hours time difference ...

el-table in vue realizes automatic ceiling effect (supports fixed)

Table of contents Preface Implementation ideas Ef...

MySql Sql optimization tips sharing

One day I found that the execution speed of a SQL...