美文网首页
python sublime 添加python解释器&控制台乱码

python sublime 添加python解释器&控制台乱码

作者: seven1010 | 来源:发表于2021-03-29 12:51 被阅读0次
  • 用sublime text 3开发Python,控制台乱码。打印英文也乱码,所以不是中文的原因,配置一下python编译环境就好 print(“ok”);

  • 打开 Tools -> Build System -> New Build System 在打开的文件中粘贴一下代码,注意cmd标签的python.exe的地址要换成Python安装地址

    {
      "cmd":["D:/Anaconda3/python.exe","-u","$file"],
      "file_regex":"^[ ]*File \"(...*?)\", line ([0-9]*)",
      "selector":"source.python",
      "env": { "PYTHONIOENCODING": "utf8" },//新增编码,如果有"encoding": "utf-8" 则替换
      "shell": "true",
      }
    
  • 保存为py.sublime-build

  • 设置编译环境Tools -> Build System -> py 运行就通过了

相关文章

网友评论

      本文标题:python sublime 添加python解释器&控制台乱码

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