downloading
Please enter the following command in the terminal:
cd /home wget /dist/python/3.6.5/Python-3.6.
Description: The function of this sentence is to download a file from a specified URL using the wget software (beginners, please help yourself to the software, which will be often used later). The format is.
wget space URL address. And the download directory is the current directory, so you need to cd to where you need to put the download file.
2. Unzip the Python3 installation files
Please enter the following command in the terminal:
tar -zxvf Python-3.6.
Explanation: tar is a Linux unzip command, which unzips the file into the folder where the file is located. If you are using the Saturn interface, you can unzip the file as you would on Win. You can also download the Python source files and place them in the specified folder as you would on Win.
3. Install the compilation environment required to compile Python3 source files.
yum install -y gcc yum install -y zlib* yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Description:The function here is very simple to say yum command. Although linux can also download software from the official website of the specified software as on Win, there are some commonly used and public software that will be placed in specific remote repositories, which can be installed by using the yum command. The yum command can also actively help users to solve software dependency problems. So if you want to learn linux well, it is necessary to know about yum. There is also anaconda which is a similar program.
4. Go to the Python3 source folder.
cd Python-3.6.5/
5. Specify the installation directory
./configure --prefix=/usr/local/python3 --with-ssl
Note: Don't forget the "..." at the top.
6. Compile source files
make
7. Formal installation
make install
8. Establishing a soft connection
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
Description:
Many tutorials have a last step, but few sites will tell you why there is a last step. A so-called soft connection is the equivalent of a shortcut under Win. You can use the shortcut to open the software you want to use. But why put the shortcut in /usr/bin/. It's about environment variables. You can add /usr/local/python3/bin directly to the environment variables without using the last softwire, that's up to you. But here /usr/bin/ is already in the environment variable by default. Putting a shortcut to this folder is equivalent to indirectly adding Python3 to the environment variable, so that you can directly open Python by typing "python3" in the terminal.
Why don't you put the softlink on the desktop? I think there are two reasons: first, it's not possible to operate Python3 from the command line in the terminal. second, not all Linux systems have a graphical interface, so there may not be a desktop, dear!
As for the last sentence it is to create a software connection for pip. pip3 is a software built into Python 3. It is used to install Python packages. For example, to install the numpy package of Python3. Just use the following command in the terminal:
pip3 install requests
This is the end of this article about installing python3 in Linux environment. I hope it will help you to learn more and I hope you will support me more.