Unnikrishnan
Unnikrishnan

Reputation: 33

Downgrading Python version on Ubuntu

Can someone please tell me how to downgrade Python 3.6.9 to 3.6.6 on Ubuntu ? I tried the below commands but didnot work

1) pip install python3.6==3.6.6

2) pip install python3.6.6

Upvotes: 3

Views: 13746

Answers (2)

Michael Ruth
Michael Ruth

Reputation: 3504

First, verify that 3.6.6 is available:

apt-cache policy python3.6

If available:

apt-get install python3.6=3.6.6

If not available, you'll need to find a repo which has the version you desire and add it to your apt sources list, update, and install:

echo "<repo url>" >> /etc/apt/sources.list.d/python.list
apt-get update
apt-get install python3.6=3.6.6

I advise against downgrading your system python unless you're certain it's required. For running your application, install python3.6.6 alongside your system python, and better yet, build a virtual environment from 3.6.6:

apt-get install virtualenv
virtualenv -p <path to python3.6.6> <venv name>

Upvotes: 3

Arthur Tacca
Arthur Tacca

Reputation: 9989

One option is to use Anaconda, which allows you to easily use different Python versions on the same computer. Here are the installation instructions for Anaconda on Linux. Then create a Conda environment by running this command:

conda create --name myenv python=3.6.6

Obviously your can use a different name than "myenv". You can then activate the environment in any terminal window:

conda activate myenv

Then you can pip install any packages you want. Some basics of anaconda environments can be found on the website's getting started page.

Upvotes: 2

Related Questions