Downgrade Python 3.9 to 3.8

Muhammad Maisam Abbas Oct 10, 2023
  1. Downgrade Python 3.9 to 3.8 With the virtualenv Module
  2. Downgrade Python 3.9 to 3.8 With Anaconda
  3. Downgrade Python 3.9 to 3.8 With the Control Panel
Downgrade Python 3.9 to 3.8

You can use three effective methods to downgrade the version of Python installed on your device: the virtualenv method, the Control Panel method, and the Anaconda method. Here in our tutorial, we’ll provide you with the details and sample codes you need to downgrade your Python version.

Downgrade Python 3.9 to 3.8 With the virtualenv Module

The virtualenv method is used to create and manage different virtual environments for Python on a device; this helps resolve dependency issues, version issues, and permission issues among various projects.

Suppose we are dealing with a project that requires a different version of Python to run. In that case, we can use the virtualenv module to create a new virtual environment for that specific project and install the required version of Python inside that virtual environment. To create a virtual environment, we first have to install the vritualenv module. Here’s the command to install this module:

pip install virtualenv

Now, we can create our virtual environment using the virtualenv module. The command to create a new virtual environment is given below.

virtualenv \path\to\env -p \path\to\python_install.exe

Here, \path\to\env is the path of the virtual environment, and \path\to\python_install.exe is the path where the required version of Python is already installed. For this command to work, we have to install the required version of Python on our device first.

Upon installation, you just have to activate our virtual environment. You can do so by executing the command below:

\path\to\env\Scripts\activate.bat

Here, \path\to\env is the path of the virtual environment.

Downgrade Python 3.9 to 3.8 With Anaconda

We can also use Anaconda, just like virtualenv, to downgrade a Python version. First, you need to install Anaconda on your device. After the installation, we can create a new virtual environment for our project using the conda package manager. The command to create a virtual environment with conda is given below:

conda create -n downgrade python=3.8 anaconda

This command creates a new virtual environment called downgrade for our project with Python 3.8. The next step is activating our virtual environment. The command to start a virtual environment using conda is given below.

activate downgrade

The command above activates the downgrade virtual environment. Now, we can install all the packages required for our special project.

This approach is very similar to the virtualenv method. However, the conda method is simpler and easier to use than the previous approach. We don’t even need to install another Python version manually; the conda package manager automatically installs it for us.

Downgrade Python 3.9 to 3.8 With the Control Panel

This method only works for devices running the Windows Operating System. This approach involves manually uninstalling the previously existing Python version and then reinstalling the required version.

We can uninstall Python by doing these steps: Go to Control Panel -> Uninstall a program -> Search for Python -> Right Click on the Result -> Select Uninstall.

Now that the previous version of Python is uninstalled from your device, you can install your desired software version by going to the official Python download page.

This approach is the least preferred one among the ones discussed in this tutorial. It’s because this approach only works for Windows and should only be used when we don’t need the previous version of Python anymore.

The best approach for downgrading Python or using a different Python version, aside from the one already installed on your device, is using Anaconda. The commands for using Anaconda are very simple, and it automates most of the processes for us.

Muhammad Maisam Abbas avatar Muhammad Maisam Abbas avatar

Maisam is a highly skilled and motivated Data Scientist. He has over 4 years of experience with Python programming language. He loves solving complex problems and sharing his results on the internet.

LinkedIn

Related Article - Python Version