To install the sublime plugin:
Inbefore installing the sublime plug-in, you need to install the package control component, and then install the plugin directly online:
1) Sublimecodeintel plug-in
The Sublimecodeintel plugin enables you to automatically prompt Python code, view system functions, jump-track custom functions, and more.
Installation: Under the conditions of installing the package control component, ctrl+shift+p type install packages, and then continue typing Sublimecodeintel installation. Also need to configure: Select Perference-package settings-sublimecodeintel-settings-user, copy the following configuration:1 {2 "codeintel_language_settings": {3 "Python27": {4 "python27":"D:\\python27\\python.exe",5 "Codeintel_scan_extra_dir": [6 "D:\\python27\\lib\\idlelib",7 "C:\\windows\\system32\\python27.zip",8 "D:\\python27\\dlls", 9 "D:\\python27\\lib",Ten "D:\\python27\\lib\\plat-win", One "D:\\PYTHON27\\LIB\\LIB-TK", A "d:\\python27", - "d:\\python27\\lib\\site-packages"], - "Codeintel_scan_files_in_project": True, the "Codeintel_selected_catalogs": [] - }, - } -}
Here the Python path needs to be defined according to its own installation path, where Codeintel_scan_extra_dir contains directories that can be viewed Sys.path in Python IDLE (which can be found in the directory where Python is installed), Such as:
If you are using the Python3, do not forget to change the Python27 to Python3 Oh. Finally, Ctrl+s save and restart .
2) Configure native Python in sublime Text3
Sublime has a Python compilation environment (which may also be called locally, after all), but if you do not configure native Python, the subsequent use of sublime to write Python requires an import package when the package is not found .
Configuration: Tools-->build system-->new Build System in the sublime menu ... Enter the following code:
1 {2 "cmd": ["python","- u","$file"],3 "File_regex":"^[]*file \ "(... *?) \ ", line ([0-9]*)",4 "selector":"Source.python",5 "encoding":"Utf-8",6}
Then save it and note that the file extension is:. Sublime-build, for example I'm mypython.sublime-build here, and the save path is generally in C:\Users\b6762\AppData\Roaming\Sublime Text 3\packages\user, and then Tools-->build system--> in the selection of the environment you have just defined the name Mypython, after the selection, you can use the CTRL+B directly after the environment to run OH.
Note: The above code in the "Encoding": "Utf-8" This line of utf-8 parameters, many of the online tutorial is said to see whether the system is the code, the view is win+r open a command prompt, in the title bar right click the mouse click Properties can be seen as shown in:
However, I this is 936, if changed to "encoding": "cp936", in Sublime Text3 console appears garbled .
3) write Python in sublime Text3 cannot enter content in console
After switching to the Python compilation environment in Sublime, Tools->build can compile and run Python, which is the ctrl+b of our usual shortcut keys. After that, the console will appear below. But this can only output in the console cannot be entered .
Install: Ctrl+shift+p type Install packages, and then continue typing SUBLIMEREPL installation. Then each time the compilation is run: Tools->sublimerepl->python->python-run current file. After clicking the new page *repl*[python], as a new console, you can enter and output the interaction.