User Tools

Site Tools


Sidebar

Go Back

Refresh

You are not allowed to add pages

Direct Link

library:python:installpython3.8.2oncentos

Install Python 3.8.2 for Centos


It will guide you compiling and install Python 3.8.2 on Centos.

1. Prepare and install third-party librarys

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
yum install libffi-devel -y
yum install wget -y

2. Install Python3.8.2

# Create new directory
sudo mkdir /usr/local/python3

# Download 3.8.2 (Install wget if necessary. yum install wget)
wget --no-check-certificate https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
or
wget --no-check-certificate https://www.xinsi.ltd/download/Python-3.8.2.tgz   (local server, maybe higher speed)

# Uncompress and compile
tar xzvf Python-3.8.2.tgz
cd Python-3.8.2
./configure --prefix=/usr/local/python3
sudo make && sudo make install

# Create link to app
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
sudo ln -s /usr/bin/python3 /usr/bin/python

# Verify installation
python3 -V

You Can Get:

Python 3.8.2

3.Install pip

Solution 1 :

# get installation script get-pip.py and run it.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

# start installation
sudo python3 get-pip.py
 
# Create link to application
sudo ln -s /usr/local/python3/bin/pip /usr/bin/pip3
sudo ln -s /usr/bin/pip

# Verify installation
pip3 -V
  
# You Should Get
pip 20.0.2 from /usr/local/python3/lib/python3.8/site-packages/pip (python 3.8)

Or :

Solution 2 :

You can use the pip comes along with python, and update to the latest version

sudo python3 -m pip install --upgrade pip --force-reinstall   (Maybe slow and timeout, retry)
sudo ln -s /usr/local/python3/bin/pip /usr/bin/pip3

python3 -m pip -V
or
pip3 -V
library/python/installpython3.8.2oncentos.txt · Last modified: 2022/05/02 00:32 (external edit)