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

Pure CSS3 mind map style example

Mind Map He probably looks like this: Most of the...

Linux editing start, stop and restart springboot jar package script example

Preface In the springboot configuration file, the...

The best way to solve the 1px border on mobile devices (recommended)

When developing for mobile devices, you often enc...

Example of using CSS3 to customize the style of input multiple-select box

Principle: First hide the input element, then use...

Detailed explanation of the use of Element el-button button component

1. Background Buttons are very commonly used, and...

This article will help you understand JavaScript variables and data types

Table of contents Preface: Kind tips: variable 1....

Unicode signature BOM (Byte Order Mark) issue for UTF-8 files

I recently encountered a strange thing when debug...

10 Popular Windows Apps That Are Also Available on Linux

According to data analysis company Net Market Sha...

Five delay methods for MySQL time blind injection

Five delay methods for MySQL time blind injection...

TCP third handshake data transmission process diagram

The process packets with the SYN flag in the RFC7...

Vue implements nested routing method example

1. Nested routing is also called sub-routing. In ...

Detailed steps for porting busybox to build a minimal root file system

Busybox: A Swiss Army knife filled with small com...