If you already have Python 3.8, install the new Python 3.9 version, you can refer to the following steps. Here we take Linux and Windows as examples:
1. Install Python 3.9 under Linux
First, open the terminal and enter the following command to update the package list:
sudo apt update
Then, install the precompiled package dependencies:
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
Next, download the Python 3.9 source code:
wget /ftp/python/3.9.0/Python-3.9.
Unzip the downloaded source code file:
tar -xf Python-3.9.
Enter the decompressed directory:
cd Python-3.9.0
Configure source code:
./configure --enable-optimizations
Compile and install:
make sudo make altinstall
Finally, verify that Python 3.9 is installed successfully:
python3.9 --version
2. Install Python 3.9 under Windows
First, visit the Python official website to download the Python 3.9 installation package:/downloads/
Then, run the downloaded installation package, select "Customize installation", in the next step, make sure the "Add Python 3.9 to PATH" option is selected, and follow the prompts to complete the installation.
Finally, open a command prompt and enter the following command to verify that Python 3.9 is installed successfully:
python --version
The above steps can install the new Python 3.9 version if there is already Python 3.8 version, and will not affect the existing Python 3.8 version.
It looks like you are trying to install some packages that are commonly used on Debian-based systems like Debian and Ubuntu, but you seem to be using a Red Hat-based system (probably CentOS or Fedora) whose package manager is yum. Package names on these systems may vary.
You can try the following command to install these dependency libraries:
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel sqlite-devel
Here is the corresponding software package:
-
build-essential
It is usually available on Red Hat-based systemsgcc
Alternative. -
libssl-dev
It is usually available on Red Hat-based systemsopenssl-devel
Alternative. -
libffi-dev
It is usually available on Red Hat-based systemslibffi-devel
Alternative. -
libsqlite3-dev
It is usually available on Red Hat-based systemssqlite-devel
Alternative.
If your system uses dnf as a package manager (such as Fedora 22 and later and CentOS/RHEL 8), you can use the following command:
sudo dnf install -y gcc openssl-devel bzip2-devel libffi-devel sqlite-devel
You can solve this problem by following the steps:
First, you need to install the necessary libraries. On Red Hat-based systems, you can use the following command:
sudo yum install openssl-devel
On Debian-based systems, you can use the following command:
sudo apt-get install libssl-dev
After installing these libraries, you need to recompile Python. First, download the Python source code:
wget /ftp/python/3.9.0/Python-3.9.
Then, decompress the source code and enter the source code directory:
tar xvf Python-3.9. cd Python-3.9.0
Before compiling Python, you need to run the following command to ensure that the SSL module will be included:
./configure --with-ssl
Then, compile and install Python:
make sudo make install
After completing the above steps, you should be able to connect normally with HTTPS.
This is the article about the operation steps of python supporting multiple versions at the same time. For more related contents of python, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!