sublime配置python-rpel_SublimeREPL配置Python3开发

首先什么是REPL?

A Read-Eval-Print-Loop (REPL) is available both as a standalone program and easily includable in other programs. REPL provides a way to interactively run JavaScript and see the results. It can be used for debugging, testing, or just trying things out.

交互式解释器(REPL)既可以作为一个独立的程序运行,也可以很容易地包含在其他程序中作为整体程序的一部分使用。REPL为运行JavaScript脚本与查看运行结果提供了一种交互方式,通常REPL交互方式可以用于调试、测试以及试验某种想法。

可以理解执行的交互式命令行界面,相当于一个DOS界面的Shell.

Python是支持REPL的语言

配置运行Python3.5

以上是SublimeREPL配置Lua语言的文档

模仿这个可以配置Python3.5

首先Packages:Browse Package 找到 SublimeREPL的文件夹,再进入config文件夹,可以看到许多语言的配置文件,Python也在里面

62f77f6a6f2c3c8bf82955c1b11e11b7.png

在这里新建一个Python3.5的文件夹,在里面新建Default.sublime-commands和Menu.sublime-menu两个文件(模仿Python文件夹)我们Python3.5目前只要能打开shell运行,和运行这个脚本,两个功能,因此就只要包含Python3.5 和 Python3.5 – Run current file两项就好了

Default.sublime-commands配置如下:

[

{

"caption": "SublimeREPL: Python3.5",

"command": "run_existing_window_command", "args":

{

"id": "repl_python3.5",

"file": "config/Python3.5/Main.sublime-menu"

}

},

{

"caption": "SublimeREPL: Python3.5 - RUN current file",

"command": "run_existing_window_command", "args":

{

"id": "repl_python3.5_run",

"file": "config/Python3.5/Main.sublime-menu"

}

}

]

Menu.sublime-menu配置如下:

[

{

"id": "tools",

"children":

[{

"caption": "SublimeREPL",

"mnemonic&#

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sublime Text 配置 Python 环境的步骤如下: 1. 安装 Python:首先需要安装 Python,可以从官网下载安装包进行安装。 2. 安装 Package Control:在 Sublime Text 中安装 Package Control,可以通过按下 Ctrl + `(Windows 和 Linux)或 Command + `(Mac)打开控制台,然后在控制台中输入以下代码: ``` import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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) ``` 3. 安装 SublimeREPL:在 Sublime Text 中安装 SublimeREPL,可以通过按下 Ctrl + Shift + P(Windows 和 Linux)或 Command + Shift + P(Mac)打开命令面板,然后输入“Package Control: Install Package”并按下 Enter 键,然后输入“SublimeREPL”并按下 Enter 键进行安装。 4. 配置 SublimeREPL:在 Sublime Text 中配置 SublimeREPL,可以通过按下 Ctrl + Shift + P(Windows 和 Linux)或 Command + Shift + P(Mac)打开命令面板,然后输入“SublimeREPL: Python”并按下 Enter 键,然后选择“Python - RUN current file”或“Python - RUN current file (external system)”进行配置。 5. 配置 Python 环境:在 Sublime Text 中配置 Python 环境,可以通过在 SublimeREPL 中输入以下代码进行配置: ``` import sys sys.path.append('/path/to/python/lib') ``` 其中,/path/to/python/lib 是 Python 库的路径。 6. 运行 Python:在 Sublime Text 中运行 Python,可以通过按下 Ctrl + Shift + P(Windows 和 Linux)或 Command + Shift + P(Mac)打开命令面板,然后输入“SublimeREPL: Python”并按下 Enter 键,然后选择“Python - RUN current file”或“Python - RUN current file (external system)”进行运行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值