Tutorial on installing and uninstalling python3 under Centos7

Tutorial on installing and uninstalling python3 under Centos7

1. Install Python 3

1. Install dependency packages yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc* make -y

2. Download the Python installation package wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz

The reason for downloading and installing python3.5.2 here is mainly because of the good stability of Django in the later stage.

3. Unzip the Python installation package tar -Jxvf Python-3.5.2.tar.xz

4. Configure the installation path

Go to the unzip directory

./configure prefix=/usr/local/python3

5. Compile and install

Go to the unzip directory

make && make install

6. Configure soft connection ln -s /usr/local/python3/bin/python3 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

Now you can use python3.5.2 and pip3 normally

It is found here that pip3 cannot be used after configuring soft link:

Solution:

[root@localhost bin]# which pip3 /usr/bin/pip3 [root@localhost bin]# pip3-bash: /usr/local/bin/pip3: no such file or directory [root@localhost bin]# type pip3 pip3 has been hashed (/usr/local/bin/pip3) [root@localhost bin]# hash -r [root@localhost bin]# type pip3 pip3 is /usr/bin/pip3 

7. Export the list of packages previously installed by Python in Windows

Open cmd and switch to the desktop

pip freeze > package.txt

Then import it into Centos7 and install the modules in the file with pip3

At this point, the functions and common modules in python3 have been installed and can be used normally

Uninstall python3

View the current Python version:

python -V

Note that when uninstalling, python is followed by 2 or 3 or nothing, otherwise all will be deleted.

Uninstall python3 rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps Uninstall pyhton3 whereis python3 |xargs rm -frv Delete all residual files Successfully uninstalled! whereis python View the existing installed Python

Summarize

The above is the tutorial on how to install and uninstall python3 on Centos7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Centos8 (minimum installation) tutorial on how to install Python3.8+pip
  • Install the latest python3.8 under Centos7
  • Detailed steps to install python3.7 on CentOS6.5
  • Detailed tutorial on installing Python3 on CentOS7
  • Solution for not being able to use pip after installing python3.7.1 on centos6.5
  • Installation of python2.7.10 under Linux system (CentOS)
  • Tutorial analysis on installing Python3 under CentOS7

<<:  Detailed explanation of client configuration for vue3+electron12+dll development

>>:  The data folder failed to be created automatically during the installation of mysql8.0.14.zip. The service cannot be started.

Recommend

Use of Linux usermod command

1. Command Introduction The usermod (user modify)...

jQuery canvas draws picture verification code example

This article example shares the specific code of ...

WEB Chinese Font Application Guide

Using fonts on the Web is both a fundamental skill...

Share the problem of Ubuntu 19 not being able to install docker source

According to major websites and personal habits, ...

DOM operation table example (DOM creates table)

1. Create a table using HTML tags: Copy code The ...

Sharing ideas on processing tens of millions of data in a single MySQL table

Table of contents Project Background Improvement ...

A detailed account of the process of climbing a pit of Docker deployment service

First time writing. Allow me to introduce myself....

CSS box hide/show and then the top layer implementation code

.imgbox{ width: 1200px; height: 612px; margin-rig...

Docker packages the local image and restores it to other machines

1. Use docker images to view all the image files ...