1

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!

1
  • Install few versions Commented Jun 9, 2020 at 22:05

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer! But how can I create a virtual environment using Python 3.4.x if I have Python 3.6.9 installed on my Ubuntu? Thanks
1

I highly recommend using Pyenv to manage versions. You won't have to downgrade anything, just choose a different global python version.

Comments

0

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

Thanks for your answer! After I installed Python 3.4 using deadsankes PPA, I got an import error when trying to create a virtual environment using Python3.4.
@Wendy Ah whoops, I hadn't noticed that venv isn't installed by default. Run sudo apt-get install python3.4-venv to install it. I updated the answer too.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.