Updated on 2024-09-06 GMT+08:00

Installing Python 3.9.9

Preparing the Environment

Perform the following operations in sequence. Otherwise, Python 3.9.9 may fail to be installed (SSL component dependency fails). As a result, PoWA-collector and PoWA-web fail to be installed.

yum install readline* -y

yum install zlib* -y

yum install gcc-c++ -y

yum install sqlite* -y

yum install openssl-* -y

yum install libffi* -y

Installing Python 3.9.9

  1. Run the following command as user root:

    mkdir env

    cd env

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

    tar -xzvf Python-3.9.9.tgz

    cd Python-3.9.9

    ./configure --prefix=/usr/local/python3.9.9

    make && make install

  2. Create a soft link.

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

    ln -s /usr/local/python3.9.9/bin/pip3.9 /usr/bin/pip

Verify the Installation.

  1. Verify the installation, especially the SSL function.

    [root@ecs-ad4d Python-3.9.9]# python

    Python 3.9.9 (main, Nov 25 2021, 12:36:32)

    [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux

    Type "help", "copyright", "credits" or "license" for more information.

    import ssl

    import urllib.request

    context = ssl._create_unverified_context()

    urllib.request.urlopen('https://www.example.com/',context=context).read()

  2. If any command output is displayed, the installation is successful. Run the following command to exit.

    quit()