简体   繁体   English

IPython 4 shell 不适用于 Sublime REPL

[英]IPython 4 shell does not work with Sublime REPL

I am having problems with running the IPython shell from the Sublime REPL package.我在从 Sublime REPL 包运行 IPython shell 时遇到问题。

Here is what I get:这是我得到的:

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

Does anyone has a solution how this might be fixed?有没有人有解决方案如何解决这个问题? I have the latest version of pyzmq installed and run under Python 2.7.10-0我安装了最新版本的 pyzmq 并在 Python 2.7.10-0 下运行

With the release of IPython 4.0, the structure has completely changed, and is now implemented as a kernel for the Jupyter core, which is capable of running IPython-like sessions using many different languages other than Python.随着 IPython 4.0 的发布,结构已经完全改变,现在作为Jupyter核心的内核实现,它能够使用除 Python 之外的许多不同语言运行类似 IPython 的会话。 IPython is still the "reference implementation", however.然而,IPython 仍然是“参考实现”。

With these changes, the internal API has also changed quite a bit, and some parts have been moved/renamed or just aren't there at all.通过这些更改,内部 API 也发生了很大变化,某些部分已被移动/重命名或根本不存在。 I've put together complete instructions on updating SublimeREPL for IPython 4 as a gist on Github, but I'll go over the key parts here.我已经在 Github上汇总了有关更新 SublimeREPL for IPython 4 的完整说明,作为 Github 上的要点,但我将在这里介绍关键部分。

The first thing you need to do is make sure you have all the components of IPython and Jupyter, as it's been split up from one monolithic packages to quite a number of smaller ones.您需要做的第一件事是确保您拥有 IPython 和 Jupyter 的所有组件,因为它已从一个整体包拆分为许多较小的包。 Run

[sudo] pip install -U ipython jupyter

from the command line to get all the pieces - no compiler should be necessary.从命令行获取所有部分 - 不需要编译器。 sudo is in case you're on a Unix/Linux system and need admin access, and the -U flag means the same thing as --upgrade . sudo是在你使用的是Unix / Linux系统,并具备管理员权限的情况下,和-U标志意味着同样的事情--upgrade

Once that's done, open Sublime and select Preferences → Browse Packages… to open your Packages folder in your operating system's file browser application (Finder, Windows Explorer, Nautilus, etc.).完成后,打开 Sublime 并选择Preferences → Browse Packages…以在操作系统的文件浏览器应用程序(Finder、Windows Explorer、Nautilus 等)中打开Packages文件夹。 Open the SublimeREPL folder, then config , then Python , then open ipy_repl.py in Sublime.打开SublimeREPL文件夹,然后是config ,然后是Python ,然后在 Sublime 中打开ipy_repl.py Delete its entire contents, and replace it with the file included in the gist link above (click here for the raw copy-and-paste version).删除其全部内容,并将其替换为上面 gist 链接中包含的文件(单击此处获取原始复制粘贴版本)。

Save ipy_repl.py with the new contents, and that should be it!用新的内容保存ipy_repl.py ,就是这样! You can now open the IPython REPL in the usual way, and you should see:你现在可以用通常的方式打开 IPython REPL,你应该看到:

Jupyter Console 4.0.2

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic

In [1]: 

If you'd like to get rid of the [ZMQTerminalIPythonApp] message, read through the instructions in the gist.如果您想摆脱[ZMQTerminalIPythonApp]消息,请通读要点中的说明。 However, the message is harmless, so you can safely ignore it if you want.但是,该消息是无害的,因此您可以根据需要安全地忽略它。

Good luck!祝你好运!

NOTE: These changes have been submitted to the main SublimeREPL project as pull requests, but seeing as the author hasn't been working on the plugin for some time, it may be a while before it's part of the main branch.注意:这些更改已作为拉取请求提交到主 SublimeREPL 项目,但由于作者已经有一段时间没有开发插件了,它可能需要一段时间才能成为主分支的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM