The complete error message is shown below:

Not to read the error principle, but the solution is as follows:
Open the error file (pcacode.py in this case) using Notepad ++ (which is the editor I always use), find the encoding option in the menu bar, select UTF-8, save it, and run the Python code again so it doesn’t report any errors.

Not to read the error principle, but the solution is as follows:
Open the error file (pcacode.py in this case) using Notepad ++ (which is the editor I always use), find the encoding option in the menu bar, select UTF-8, save it, and run the Python code again so it doesn’t report any errors.

Another solution, which I haven’t tried, is the following:
import codecs
codecs.open('filename',encoding='uft-8')
Read More:
- When reading the CSV file with Python 3, the Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0xd0 in position 0: invalid con appears
- The solution to the error of importing CSV from Python to Python
- ASP.NET How to deal with “unexpected character” when writing code
- [turn] right click to open the prompt [shellexecute failed (2): is this command correct? (fix)] with Notepad + +
- Compiler error message: cs1056: unexpected character handling
- Save file and exit command of vim
- Java prompt unmappable character for encoding solution
- In Python sys.argv Usage of
- The use of Chinese characters in Qt and the solution to the “error C2001: newline in constant” problem
- Notepad + + has no plug-in manager solution
- Vtk8.0 compilation process record under vs2017 and qt5.12.1
- Origin — draw the curve with error bar
- Solution to the problem of Chinese garbled in gradle console in idea
- IIS express failed to start
- Python error: command error out with exit status 1:
- Vs2012 compiling PCL dependency library vtk7.0
- Installing gensim in Anaconda
- Solution of Unicode decodeerror -‘utf-8 ‘codec can’t decode byte 0xc4 in position 0 – invalid continuation byte
- When nodejs is installed: the error code is 2503
- Indenta in Python tionError:unindent does Error