Downgrade Python

Today, we are going to see how to downgrade Python using different operating systems but first have a look at the short introduction to python.

What is Python?

Python is the most demanded and updated programming language which is used by almost every programmer. Python is mainly used in AI, Robotics, and Machine learning it can also be used for building websites and software.

It an easy-to-learn and easy-to-execute programming language, python has a wide range of libraries and packages and we can install or import them easily by using the pip. Python pip is a package manager which installs the packages in python.

Let’s see how to downgrade the updated python version:
There are three ways to downgrade your python version, the first one is by uninstalling the existing python version from your system and the other one is by installing the virtual environment and then running the virtualenv \path\to\env -p \path\to\python_install.exe command in the system command prompt.

Let’s see how can we follow the above methods in windows.

Downgrade Python in windows

1st Way

You can downgrade python by uninstalling the existing python version from your windows environment.

Follow These Steps

Step 1: go to your windows menu or click on the windows icon button a menu will appear.

Step 2: from the menu, select settings and hit the enter button or you can also search for settings and then click on it.

Step 3: settings will appear, from settings, find apps, and then click on them.

Step 4: in the apps portion you will the list of installed apps in your system select Python, and an option will appear focus on uninstall and click on it.

Then python will be uninstalled and you can install the old version of your choice from the browser again. 

Let’s move forward to our next way to downgrade python in windows.

2nd Way

If you don’t like the latest version of python and you want your old version back so execute the following command in the windows command prompt.

pip install virtualenv

Let it successfully installed in the system after installing the environment run the following command:

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

Through this command, we are creating a virtual environment where we can have our desired version of python and packages.

The starting path in the command is the place where the environment will be stored and the end path in the command will keep the path where the installer is exist.

3rd Way

There is another but least used way which can be used for downgrading python in windows, that is called the anaconda prompt method let’s see how it works.

We can use the conda install python= version command to overwrite the existing version of python and can install the new or old version according to our wish.

We can also check the available version by executing the following command in the conda prompt:

conda search python

The above command will show you the list of all available versions of python. 

Let’s see how to downgrade python using Linux and macOS.

Downgrade python in Linux

You have to install the python version first in your Linux environment by running the following command in the Linux terminal.

$mkdir /home/<user>/python3.9

$ ./configure --prefix=/home/<user>/python3.9/ 

$ make altinstall

After installing the old version just add it to the path as lib to LD_LIBRARY_PATH.

If you want to downgrade python by creating an environment so execute the following command in the Linux terminal.

/home/<user>/python3.6/bin/python3.9 -m venv env-python3.9

Downgrade python in macOS

Here we will take help from pyenv and homebrew commands, and run the fowling commands in the macOS terminal.

Brew update 

#Then

Brew install pyenv

This command will install pyenv.

pyenv install 3.9

After installing pyenv the above command will install the old python version that is 3.9.

pyenv shell 3.9

It will set the environment PYENV_VERSION to your mentioned version of python.

Conclusion

In this tutorial, we talked about how to downgrade python, firstly we saw an introduction to python.

We discussed the three ways to downgrade python in windows.

We also discussed the commands for downgrading python using different systems like Linux and macOS.

That’s all for today hope you like the tutorial if you have any queries regarding this article so feel free to contact us below. Thanks for reading.

Suggested Article:

Leave a Comment