python3在linux运行输出中文出错
py文件是#encoding=utf-8编码 然后执行时输出错误 print('\u2312') 这是默认输出编码为ascii。 可进入python执行环境下查看 ``` import sys sys.stdout ``` ### 解决办法1: If you get this error when you try to pipe/redirect output of your script UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128) Just export PYTHONIOENCODING in console and then run your code. 修改.profile 添加一行: PYTHONIOENCODING=utf-8 后执行source .profile ###解决办法2: 在py文件开头加入: ``` import sys import