Linux installing Python

 September
2021-06-07 / 1 comments / 71 reading / Checking for inclusion

https://www.python.org/ftp/python/

download

 wget  https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz

decompression

 tar -xf Python-3.9.5.tgz cd Python-3.9.5

Compile and install

 ./configure && make && make install

Wait patiently...

Check whether the version is installed successfully

 python3 -V

Establishing a soft link

At the end of the compilation, the program is usually installed in the /usr/local/bin lower
If Python - V does not display the version, create a soft link, which takes effect globally
Soft connection

 ln -s /usr/local/bin/python3.9 /usr/bin/python ln -s /usr/local/bin/python3.9-config /usr/bin/python-config

PIP command error

-bash: pip: command not found

Solution (CentOS version)

Download PIP script

 wget  https://bootstrap.pypa.io/get-pip.py

Python executes PIP script installation

 python3 get-pip.py

View PIP version

 pip -V

Uninstall Python 3

 rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps

Delete all remaining files

 whereis python3 |xargs rm -frv

View an existing installation of Python

 whereis python
zero

Comments (1)

cancel
  1.  head portrait
    Dark
    Android · Google Chrome

    study

    reply