在菜单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" } } ] }