SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Python36\python.exe on line 1, but no encoding declared

Viewed 19736
SyntaxError: Non-UTF-8 code starting with '\x90' in file
C:\Python36\python.exe on line 1, but no encoding declared

I don't understand why it shows me that when I want to open the interpreter. Can someone help me please?

snap shot

3 Answers

In my case I got this error on running pyinstaller's exe file from cmd and it automatically got fixed when I ran that file by directly clicking on it NOT from cmd

So, to fix this problem don't run file from terminal/cmd, try any other way.

Ok, it's a wrong value for PYTHONSTARTUP which was asking me a problem. Thank you all !

Python 3 assumes scripts are saved with UTF-8 encoding. The script being executed (from PYTHONSTARTUP?) is not UTF-8-encoded. If you know the encoding, you can add it to the top of the script with:

#coding:cp1252     (or whatever the encoding is).

Or just re-save the script in UTF-8.

See also PEP 0263.

Related