VSCode中python代码输出中文乱码解决方法

在 vscode 中编写 python 代码,输出中文时,控制台输出为乱码解决方法:

先检查右下角编码集设置是否正确

修改完后运行仍不行,可以在”文件”-”首选项”-”用户设置”中搜索 code-runner.executorMap 选项,提示需要在 setting.json 中修改

在 json 中添加下列属性

1
2
3
"code-runner.executorMap": {
"python": "set PYTHONIOENCODING=utf8 && python -u"
}
https://mp.weixin.qq.com/s/QIJ-QHkxZUyKyQAPG49vPg

VSCode中python代码输出中文乱码解决方法
https://www.gishai.top/blog/posts/87ed0839.html
作者
Hai
发布于
2019年9月12日
更新于
2022年6月10日
许可协议