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

Solution to the problem that VC6.0 cannot be used when installed on WIN10

VC6.0 is indeed too old VC6.0 is a development to...

Steps to install MySQL on Windows using a compressed archive file

Recently, I need to do a small verification exper...

Detailed installation and configuration of hadoop2.7.2 under ubuntu15.10

There are many Hadoop installation tutorials on L...

Sample code for CSS dynamic loading bar effect

Using the knowledge of CSS variables, I will dire...

Vue project @change multiple parameters to pass multiple events

First, there is only one change event. changeleve...

MySQL8.0.18 configuration of multiple masters and one slave

Table of contents 1. Realistic Background 2. Agre...

How to allow all hosts to access mysql

1. Change the Host field value of a record in the...

MySQL GTID comprehensive summary

Table of contents 01 Introduction to GTID 02 How ...

Vue implements simple image switching effect

This article example shares the specific code of ...

Do you know how to use vue-cropper to crop pictures in vue?

Table of contents 1. Installation: 2. Use: 3. Bui...

Automatically log out inactive users after login timeout in Linux

Method 1: Modify the .bashrc or .bash_profile fil...

Vue implements bottom query function

This article example shares the specific code of ...

A Brief Analysis of the Differences between “:=” and “=” in MySQL

= Only when setting and updating does it have the...

How to use Portainer to build a visual interface for Docker

Portainer Introduction Portainer is a graphical m...