Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

https://stackoverflow.com/questions/41986507/unable-to-set-default-python-version-to-python3-in-ubuntu








Code Block
titleremove link and add new one
librenms@librenms:/usr/bin$ ls -al | grep python
-rwxr-xr-x  1 root root        1056 Apr 16  2018 dh_python2
lrwxrwxrwx  1 root root          23 Apr 15 17:20 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root          23 Apr 18 01:56 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx  1 root root          31 Apr 28 04:46 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root           9 Apr 16  2018 python -> python2.7
lrwxrwxrwx  1 root root           9 Apr 16  2018 python2 -> python2.7
-rwxr-xr-x  1 root root     3637096 Apr 15 17:20 python2.7
lrwxrwxrwx  1 root root           9 Apr 28 04:46 python3 -> python3.6
-rwxr-xr-x  2 root root     4526456 Apr 18 01:56 python3.6
-rwxr-xr-x  2 root root     4526456 Apr 18 01:56 python3.6m
lrwxrwxrwx  1 root root          10 Apr 28 04:46 python3m -> python3.6m
lrwxrwxrwx  1 root root          29 Apr 16  2018 pyversions -> ../share/python/pyversions.py
librenms@librenms:/usr/bin$ sudo unlink python
librenms@librenms:/usr/bin$ sudo ln -sv /usr/bin/python3.6 python
'python' -> '/usr/bin/python3.6'
librenms@librenms:/usr/bin$ python
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
librenms@librenms:/usr/bin$






  • sudo apt-install python3.7 Install the latest version of python you want
  • cd /usr/bin Enter the root directory where python is installed
  • sudo unlink python or sudo unlink python3 . Unlink the current default python
  • sudo ln -sv /usr/bin/python3.7 python Link the new downloaded python version
  • python --version Check the new python version and you're good to go