Solve Python error Unicode error ‘UTF-8’

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.

Another solution, which I haven’t tried, is the following:

import codecs
codecs.open('filename',encoding='uft-8')

Read More: