Run Python3.4 and Python3.7 simultaneously on Linux

0

I have a linux VM with preconfigured Python3.4. I need to have Python3.7 to run my code.

I tried to uninstall Python3.4 but there are some system dependencies, so I kept old version. Then I downloaded and installed Python3.7.1.tgz (sudo make).

But now I can't access Python 3.7 instance. When I run a "python3" command, Python 3.4 is run, when "python3.7" then I get a "command not found" message.

How do I proceed? Is it okay to have two versions of Python 3 installed on one machine? What with installation packages by "pip"?

Jareq

Posted 2019-01-13T14:02:56.420

Reputation: 3

2

Have you installed it properly? Just go through this link once https://serverfault.com/q/918335

– Prvt_Yadav – 2019-01-13T15:11:06.240

@P_Yadav, thank you for the link. It resolved my problem. – Jareq – 2019-01-13T15:42:31.330

Answers

0

I would not recommend manually fiddling around with source code installations and paths. Use pyenv and save yourself the trouble.

All you have to do is:

  • Run the pyenv installer
  • Follow the instructions
  • Install the Python versions you need
  • Choose which Python version you want to use for a given directory, or globally

For example, to install 3.7, check which versions are available:

pyenv install -l | grep 3.7

Then run:

pyenv install 3.7.1

Now, you can choose your Python version:

pyenv global 3.7.1

This switches your python to point to 3.7.1. If you want the system python, run:

pyenv global system

To check which Python versions are available, run pyenv versions.

slhck

Posted 2019-01-13T14:02:56.420

Reputation: 182 472