IPython 4 shell 不适用于 Sublime REPL

IPython 4 shell does not work with Sublime REPL

我在使用 Sublime REPL 包中的 运行 宁 IPython shell 时遇到问题。

这是我得到的:

C:\Anaconda\lib\site-packages\IPython\config.py:13: ShimWarning: 
The`IPython.config` package has been deprecated. You should import from 
traitlets.config instead.
"You should import from traitlets.config instead.", ShimWarning)

C:\Anaconda\lib\site-packages\IPython\terminal\console.py:13: ShimWarning:  
The `IPython.terminal.console` package has been deprecated. You should 
import from jupyter_console instead.
"You should import from jupyter_console instead.", ShimWarning)

C:\Anaconda\lib\site-packages\IPython\frontend.py:21: ShimWarning: The top-
level `frontend` package has been deprecated. All its subpackages have been 
moved to the top `IPython` level.
"All its subpackages have been moved to the top `IPython` level.", 
ShimWarning)

Traceback (most recent call last):
File "C:\Users\Vladimir\AppData\Roaming\Sublime Text 
3\Packages/SublimeREPL/config/Python/ipy_repl.py", line 45, in <module>
from IPython.frontend.terminal.console.app import ZMQTerminalIPythonApp
ImportError: No module named app

有人知道如何解决这个问题吗?我安装了最新版本的 pyzmq 并且 运行 在 Python 2.7.10-0

随着 IPython 4.0 的发布,结构已经完全改变,现在作为 Python 以外 Jupyter core, which is capable of running IPython-like sessions using many different languages 的内核实现。然而,IPython 仍然是 "reference implementation"。

随着这些变化,内部 API 也发生了很大变化,有些部分已经 moved/renamed 或者根本不存在。我已将 complete instructions on updating SublimeREPL for IPython 4 放在一起作为 Github 的要点,但我将在此处介绍关键部分。

您需要做的第一件事是确保您拥有 IPython 和 Jupyter 的所有组件,因为它已从一个整体包拆分为多个较小的包。 运行

[sudo] pip install -U ipython jupyter

从命令行获取所有部分 - 不需要编译器。 sudo 是为了防止您使用 Unix/Linux 系统并需要管理员访问权限,而 -U 标志与 --upgrade.

的含义相同

完成后,打开 Sublime,然后 select Preferences → Browse Packages… 在操作系统的文件浏览器应用程序(Finder)中打开 Packages 文件夹, Windows Explorer、Nautilus 等)。打开 SublimeREPL 文件夹,然后 config,然后 Python,然后在 Sublime 中打开 ipy_repl.py。删除其全部内容,并将其替换为上面要点 link 中包含的文件(单击 here 获取原始复制粘贴版本)。

用新内容保存ipy_repl.py,应该就是了!你现在可以用通常的方式打开 IPython REPL,你应该看到:

Jupyter Console 4.0.2

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic

In [1]: 

如果您想删除 [ZMQTerminalIPythonApp] 消息,请通读要点中的说明。但是,该消息是无害的,因此您可以放心地忽略它。

祝你好运!

注意: 这些更改已作为拉取请求提交到主要的 SublimeREPL 项目,但鉴于作者还没有为插件工作一段时间后,它可能会成为主要分支的一部分。