python pip install: SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc6

created at 11-16-2021 views: 20

solution

Method 1: Delete UTF-8 encoding and use ASCII encoding

Delete all UTF-8 encoding content in the script program, that is, delete all Chinese.

Method 2: Indicate the encoding method of the script

In the python script program, proactively declare that we use UTF-8 encoding.

The affirmation method 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 -*- still reported an error after running, and the problem of #coding=gbk was solved perfectly.

Method 3: After checking and verifying, it is found that there is Chinese in the directory where the project is located. It is enough to change to English.

created at:11-16-2021
edited at: 11-16-2021: