1

I want to set python3.10 as default python. I want to do this because I am getting error while running ansible scripts even if the yaml files are having valid syntax.

while scanning a simple key", key.mark,
yaml.scanner.ScannerError: while scanning a simple key
  in "<unicode string>", line 16, column 1:
    "
    ^
could not find expected ':'
  in "<unicode string>", line 19, column 25:

This is how the python symlinks are in my environment. I am hosting Ubuntu instance on Windows 10.

ls -l /usr/bin/python*

lrwxrwxrwx 1 root root       7 Apr 15  2020 /usr/bin/python -> python3

-rwxr-xr-x 1 root root    2555 Apr 14  2020 /usr/bin/python-argcomplete-check-easy-install-script3

-rwxr-xr-x 1 root root     314 Apr 14  2020 /usr/bin/python-argcomplete-tcsh3

lrwxrwxrwx 1 root root       9 Mar 13  2020 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3674216 Mar  8  2021 /usr/bin/python2.7

lrwxrwxrwx 1 root root      25 Jul  7 21:00 /usr/bin/python3 -> /etc/alternatives/python3

-rwxr-xr-x 1 root root 5793336 Jun 11 18:53 /usr/bin/python3.10

-rwxr-xr-x 1 root root 5490448 Mar 15 13:22 /usr/bin/python3.8
Raffa
  • 24,905
  • 3
  • 35
  • 79
Samvid
  • 11
  • 2
  • 3
    **Ubuntu 20.04** comes with **Python 3.8** ... If you need **Python 3.10** then you should upgrade to **Ubuntu 22.04** ... Altering your release default Python version will break things instead of fixing them. – Raffa Jul 11 '22 at 09:36
  • 4
    Switching to python3.10 instead of python3.8 is not going to fix syntax errors in a script or in a yaml key. Fix the syntax problem, do not try to jump through hoops. If you want to use 3.10 for a single script edit the she-bang at the beginning of the script. – Rinzwind Jul 11 '22 at 09:36
  • 1
    As others have said, do not change the system default Python version in Ubuntu. This is never a good idea and usually will break your system. You can install other versions of Python and use them independently of the system installed one, but don't touch the default. – raj Jul 11 '22 at 12:43
  • Okay, thank you for the suggestions. – Samvid Jul 12 '22 at 10:15

0 Answers0