sublimetext3运行python交互
时间: 2023-04-25 18:02:18 浏览: 151
Sublime Text 3可以通过安装插件来运行Python交互。首先,需要安装Package Control插件管理器,然后在Sublime Text 3中打开控制台(Ctrl+`或View->Show Console),输入以下代码并回车:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd'; 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)
然后按下回车,等待插件安装完成。安装完成后,按下Ctrl+Shift+P或者在菜单栏中选择Tools->Command Palette,输入“Python”并选择“Python: Run current file”,即可运行Python交互。
阅读全文