IPython 4 shell不适用于Sublime REPL

Vol*_*lov 7 python ipython sublimerepl sublimetext3 jupyter

我在从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
Run Code Online (Sandbox Code Playgroud)

有没有人有解决方案如何修复?我安装了最新版本的pyzmq并在Python 2.7.10-0下运行

Mat*_*DMo 14

随着IPython 4.0的发布,结构已经完全改变,现在作为Jupyter核心的内核实现,它可以使用除Python之外的许多不同语言运行类似IPython的会话.然而,IPython仍然是"参考实现".

通过这些更改,内部API也发生了很大的变化,有些部分已被移动/重命名,或者根本就没有.我已经把关于更新SublimeREPL for IPython 4的完整说明作为Github上的要点,但我将在这里讨论关键部分.

您需要做的第一件事是确保您拥有IPython和Jupyter的所有组件,因为它已经从一个单片软件包分成了许多较小的软件包.跑

[sudo] pip install -U ipython jupyter
Run Code Online (Sandbox Code Playgroud)

从命令行获取所有部分 - 不需要编译器.sudo如果您使用的是Unix/Linux系统并且需要管理员访问权限,那么该-U标志意味着与之相同--upgrade.

完成后,打开Sublime并选择在操作系统的文件浏览器应用程序(Finder,Windows资源管理器,Nautilus等)中Preferences ? Browse Packages…打开Packages文件夹.打开SublimeREPL文件夹,然后config,然后在Sublime中Python打开ipy_repl.py.删除其全部内容,并将其替换为上面的gist链接中包含的文件(单击此处查看原始复制粘贴版本).

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

Jupyter Console 4.0.2

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic

In [1]: 
Run Code Online (Sandbox Code Playgroud)

如果您想删除该[ZMQTerminalIPythonApp]消息,请阅读要点中的说明.但是,该消息是无害的,因此您可以安全地忽略它,如果您愿意.

祝好运!

注意:这些更改已作为pull请求提交给主SublimeREPL项目,但看到作者一段时间没有处理插件,它可能需要一段时间才能成为主分支的一部分.