UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-2: ordinal not in range(128)

UnicodeEncodeError: ‘ASCII’ Codec can’t encode characters in position 0-2: ordinal not in range(128
Solution:
(1) set the environment variable LANG
, modify ~/.profile file, and execute:

export LANG=“en_US.UTF-8” >> ~/.profile
source ~/.bash_profile

(2) Add UTF-8 to the Python execution command, execute:

export PYTHONIOENCODING=utf-8 >> ~/.bashrc
source ~/.bashrc

Transfer: https://www.cnblogs.com/beile/p/12980149.html


Read More: