-
Install the Python interpreter. Download and install the latest version of the Python interpreter, and add it to the system environment variable. -
Install Package Control. Open Sublime Text, press the ` Ctrl+"key or click the" View ->Show Console "option, enter the following command and press Enter: import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60' ; pf = 'Package Control.sublime-package' ; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( ' http://packagecontrol.io/ ' + pf.replace( ' ' , '%20' )). read (); dh = hashlib.sha256( by ).hexdigest(); print( 'Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open (os.path. join ( ipp, pf), 'wb' ). write ( by ) -
Install the SublimeREPL plug-in. Open Package Control (Ctrl+Shift+P), enter "install package" and select the "Package Control: Install Package" option. Then search for "SublimeREPL" and install the plug-in. -
Configure the SublimeREPL plug-in. Open the SublimeREPL plug-in configuration file (Preferences ->Package Settings ->SublimeREPL ->Settings – User), and enter the following: { "default_extend_env" : { "PATH" : "{PATH}:C: \\ Python \\ Python38-32" } } Where, "C: Python Python 38-32" is the path where you install the Python interpreter. Please change the path according to the actual situation. -
Configure the Sublime Text build system. Open Sublime Text and click the "Tools ->Build System ->New Build System" option. Enter the following in a new window: { "cmd" : [ "python" , "-u" , " $file " ], "file_regex" : "^[ ]*File \" (...*?)\ ", line ([0-9]*)" , "selector" : "source.python" } -
Save the build system as Python. public build and close the window. -
Write Python code in Sublime Text and try running it. You can press the Ctrl+B shortcut key or click the Tools ->Build option to execute the code and view the output results.