Sublime Text 3 is a very useful editor, use it as a Python editor, need to solve the Chinese support problem, there are two common problems, one is the Chinese garbled problem, the second is the runtime Python console can not output Chinese.
First, Chinese garbled problem
1. If you are downloading the sublime Text 3 in the official website, then the first need to install a Package control pack, which is used to install other plug-ins, no matter what plug-in, the first thing to load this package. Press ctrl+~ shortcut key to bring up a small text, then paste the following code:
Import Urllib.request,os; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.path.join (IPP, PF), ' WB '). Write (Urllib.request.urlopen (' http://sublime.wbond.net/' + pf.replace (', '%20 ')) . Read ())
So sublime Text will install the package Control we need. Otherwise, the package will not be found later.
2. After restarting sublime text, in sublime text, press Ctrl+shift+p to open the command line mode, enter the install package keyword, and then click the first item in the Automatic drop-down menu: Package Control : Install package. At this point you will see a = sign in the lower left corner to move around, wait a moment.
3. Once again, a drop-down menu appears at the command line. Enter "ConvertToUTF8" or "GBK Encoding support" to select a match. Chinese characters are displayed as normal.
-
Second, the operation console can not output Chinese solution
The default compiler can run Python directly by ctrl+b compile and output the results in the console. In the ointment is unable to output Chinese, you need to manually configure some. In Sublime Text 3, click menu Tools->build system->new build System, paste the code below and save as Python.sublime-build. The file will be stored in the C:\Users\Administrator\AppData\Roaming\Sublime Text 3\packages\python\, if there is no Python directory, can be new. Restart the sublime.
{
"cmd": ["python","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "cp936"
}
Use Sublime Text 3 as a Python editor for Chinese issues