Ubuntu 18.04 comes with Python 3.6.9 by default. In order to run a project, I need to install Python 3.4.x. Is there a way to downgrade Python 3.6.9 to 3.4.x? Many thanks in advance!
3 Answers
Python has this neat feature called virtual environments where you can setup different python versions for different projects. The documentation is pretty straightforward.
I would also recommend reading similar discussion that already exist.
As a final note I always name my virtual environment venv as its both simple and readable.
2 Comments
I highly recommend using Pyenv to manage versions. You won't have to downgrade anything, just choose a different global python version.
Comments
Ubuntu relies on Python 3.6. If you remove/change the system Python install, parts of the OS will break, like the terminal. Use a virtualenv instead.
First, you can use the deadsnakes PPA to install Python 3.4:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.4 python3.4-venv
Then set up the virtualenv. See the tutorial and venv documentation. The crucial command will be something like this:
python3.4 -m venv ...
2 Comments
venv isn't installed by default. Run sudo apt-get install python3.4-venv to install it. I updated the answer too.