[Solved] Python pip install Error: SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xc6

Python pip install Error: SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xc6

 

Solution:
Method 1: delete the UTF-8 code and use ASCII code

to delete all UTF-8 code contents in the script program, that is, delete all Chinese

Method 2: indicate the coding method of the script

in the python script program, actively declare that we use UTF-8 coding method

the method of declaration is as follows. Add the following sentence at the top of the program, especially the second sentence

#!/ usr/bin/python
# -*- coding: UTF-8 -*-

At first # – * – Coding: UTF-8 – * – it still reported an error when running again, and the problem of #coding = GBK was solved perfectly

Method 3: after checking, it is found that there is Chinese in the directory where the project is located, which can be changed to English.

Similar Posts: