Skip to content

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

@AlexZ33

Description

@AlexZ33

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

image

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

image

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

image

在 json 中添加下列属性

"code-runner.executorMap": {
"python": "set PYTHONIOENCODING=utf8 && python -u"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions