解决Win平台VSCode中Python在控制台输出中文乱码的问题

在菜单Debug->Open Configurations,打开launch.json,新增如下粉红色字符内容:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [        
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env":{
                "PYTHONIOENCODING":"gbk"
            }
        }
    ]
}

 

posted @ 2019-12-19 14:13  松山居士  阅读(924)  评论(0)    收藏  举报