首页 > 编程语言 > 详细

sublime text 2编译Python时打印中文报错的解决方案

时间:2015-03-05 10:49:56      阅读:462      评论:0      收藏:0      [点我收藏+]

当用sublime text 2 编译 python 文件时,若 print 打印出的中文时,控制台会报错:

[Decode error - output not utf-8]

解决方案如下:

打开 sublime text 2 首选项 -> 浏览插件,进入 Python 文件夹,并找到 Python.sublime-build 文件。

打开如下:

{
	"cmd": ["python", "-u", "$file"],
	"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python"
}

将其修改为:

{ 
  "cmd": ["python", "-u", "$file"], 
  "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", 
  "selector": "source.python", 
  "encoding": "cp936" 
}

即可解决该问题。

sublime text 2编译Python时打印中文报错的解决方案

原文:http://blog.csdn.net/jueblog/article/details/44078355

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!