sublime text 2 ?ctrl+b 如果出現(xiàn)運行為空白,按ctrl+`來顯示錯誤,如下所示,轉載了一篇解決方案 ? 文章參考:
http://eric.themoritzfamily.com/python-encodings-and-unicode.html http://desert3.iteye.com/blog/757508 https://github.com/misfo/Shell-T
py在編輯環(huán)境變量,但是環(huán)境變量中的字符集確少了ascii字符集
我的解決方案(參靠上面第6篇):
找到配置文件目錄位置(可以參考我的另一篇博文修改sublime Text 的默認配置文件位置)
其中的PackagesDefaultexec.py,打開編輯
找到第41-42行:
for?k,?v?in?proc_env.iteritems(): ?proc_env[k]?=?os.path.expandvars(v).encode(sys.getfilesystemencoding())
兩種修改方案:
1、果斷刪掉!(你沒看錯,就是這樣)
2、對它進行異常處理,避免它出錯時停止程序運行就像這樣:
?????for?k,?v?in?proc_env.iteritems(): ????????????try: ????????????????proc_env[k]?=?os.path.expandvars(v).encode(sys.getfilesystemencoding()) ????????????except?UnicodeDecodeError: ????????????????print?"Encoding?error..." ????????????????print?"VARIABLE:?",?k,?"?:?",?v
然后你在嘗試對pyhon或是其他程序的編譯,就會發(fā)現(xiàn)切正常了!
更多sublime相關技術文章,請訪問sublime text 2欄目。
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦