美文网首页
Vscode code-runner输出乱码

Vscode code-runner输出乱码

作者: 一个摸鱼AI喵 | 来源:发表于2021-10-11 09:52 被阅读0次

此问题并不仅仅针对中文乱码,还解决因为头文件乱码:

# !/usr/bin/env python
# coding=utf-8

如在终端正常输出为:

suggestion: block  Rate: 83.47  label: liveness

乱码为:

ϵͳ�Ҳ���ָ����·����

解决办法:

设置-扩展-Run Code configuration-Executor Map - settings.json

添加/修改内容

"code-runner.executorMap": {
    ...
    "python": "set PYTHONIOENCODING=utf8 & $pythonPath -u $fullFileName",
    ...
    }
"code-runner.respectShebang": false,

"code-runner.respectShebang": false是因为python文件配置有头文件会产生错误.

参考(https://www.jianshu.com/p/da97ca31cb73)

相关文章

网友评论

      本文标题:Vscode code-runner输出乱码

      本文链接:https://www.haomeiwen.com/subject/lxlonltx.html