When I type echo $PYTHONPATH I get
/usr/lib/python3.6But when I type python as user root I get
File "/usr/lib/python3.6/site.py", line 183
file=sys.stderr) ^
SyntaxError: invalid syntaxWhat is the reason for this error ?
When I type python3.6 I get no errors. If this question needs to be moved to UNIX SE please let me know.
91 Answer
The error you are getting is consistent with trying to run the python3.6/site.py file using python2.7:
$ python2.7 /usr/lib/python3.6/site.py File "/usr/lib/python3.6/site.py", line 183 file=sys.stderr) ^
SyntaxError: invalid syntaxSince python2.7 is still the default for Ubuntu 18.04, you should avoid setting your PYTHONPATH to a python3-specific value.