Python3默认字符编码的问题
输出报错
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
>>> import sys
>>> sys.stdout.encoding
'ANSI_X3.4-1968'
卸载Python
apt remove --purge python*
安装Python
apt install python3
apt install python3-pip
import sys import io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')