sublime text2 执行python报如图的错误,在线等 5

startup,version:2217windowsx32channel:stableexecutable:/D/ProgramFiles/SublimeText2/s... startup, version: 2217 windows x32 channel: stable
executable: /D/Program Files/Sublime Text 2/sublime_text.exe
working dir: /C/Windows/system32
packages path: /C/Users/Administrator/AppData/Roaming/Sublime Text 2/Packages
settings path: /C/Users/Administrator/AppData/Roaming/Sublime Text 2/Settings
PackageSetup not required
Py_GetProgramName(): sublime_text.exe
Py_GetExecPrefix(): D:\Program Files\Sublime Text 2
Py_GetProgramFullPath(): D:\Program Files\Sublime Text 2\sublime_text.exe
Py_GetPath(): D:\Program Files\Sublime Text 2\python26.zip;D:\Program Files\Sublime Text 2\DLLs;D:\Program Files\Sublime Text 2\lib;D:\Program Files\Sublime Text 2\lib\plat-win;D:\Program Files\Sublime Text 2\lib\lib-tk;D:\Program Files\Sublime Text 2
Py_GetPythonHome(): D:\Program Files\Sublime Text 2
catalogue loaded
found 4 files for base name Default.sublime-keymap
found 1 files for base name Default.sublime-mousemap
found 1 files for base name Main.sublime-menu
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\CSS\css_completions.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\comment.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\copy_path.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\delete_word.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\detect_indentation.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\duplicate_line.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\echo.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\exec.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\fold.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\font.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\goto_line.py
Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\set_unsaved_view_name.py

Reloading plugin C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\Default\transform.py

plugin init time: 0.718451

loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 2.78017
startup cache, total files: 94 cache hits: 94
startup time: 2.89005 (package setup was not run)
loaded 837 snippets
Writing file /C/Users/Administrator/Desktop/杂七杂八/a2.py with encoding UTF-8

Running D:\Python27\python

Traceback (most recent call last):
File ".\sublime_plugin.py", line 337, in run_
File ".\exec.py", line 154, in run
File ".\exec.py", line 45, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb9 in position 145: ordinal not in range(128)
展开
 我来答
粗犷绿毛君AY
2013-03-25 · TA获得超过353个赞
知道小有建树答主
回答量:451
采纳率:0%
帮助的人:392万
展开全部
.我记得在sublime text2里新建文件保存后是ascii编码的,
1.检查文件保存的格式是否utf-8(可用notepad++,把非utf-8的文件,转换为utf-8的保存)
2.python文件开头是否加上:# -*- coding:utf-8 -*-

两者都对,就不会有问题
matlab2000
2013-03-24 · TA获得超过2323个赞
知道大有可为答主
回答量:1678
采纳率:100%
帮助的人:1051万
展开全部
编码问题,要么不用中文目录看看有无问题。因为在windows中编码是ansi,但是python默认的是utf-8.你不要用中文目录保存文件,就没这个问题了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式