I have python 2.7.15+ installed and I want to upgrade to the latest version 3.7. I have come across the command from net
sudo apt-get install python 3.3.3
But this command adds another software right, it's not replacing python 2.7 How should I proceed? Would be grateful for any help.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
51 Answer
Why would you replace python 2.7? They both can live along on the same system. You can run python3 by calling python3. You can set your preferred version (what is executed by calling python to python3), but beware if there are some system scripts needing python2 but not explicitly specifying it you might break things.
For a script that should be executed by python3 you can write:
#!/usr/bin/env python3
...If you need a newer python3 install or guarantee its own name space (without modifying the system configuration) you need to work with virtual environments and custom distros like conda.
3