如何配置python的sublimeREPL

2025-01-20 02:55:28
推荐回答(2个)
回答1:

1.在控制台(CTRL+`)中复制链接;

import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; 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(' ', ' ')).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)

2.管理插件(CTRL+SHIFT+P)中,找到Package Control:install package一项,回车后继续选择SublimeREPL插件,进行安装;

3.给REPL设置一个F5的快捷键。在preferences下选择Key Bindings-user,在其中粘贴如下并保存:
[ {"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}}
]

回答2:

可以安装插件SublimeREPL试试, 调试的时候记得选 tools->SublimeREPL->python->run current file 或者 pdb current file (pdb 是调试工具, 类似gdb)不要用缺省的build 或者 ctrl-b,