[英]Is it possible to show a console in a Jupyter notebook?
I would like to be able to fiddle around in the environment using a console in a Jupyter notebook.我希望能够使用 Jupyter 笔记本中的控制台在环境中摆弄。 Adding an additional cell means that I always have to scroll to the very bottom or create new cells wherever I want a 'console-like' text field.添加一个额外的单元格意味着我总是必须滚动到最底部或在任何我想要“类似控制台”的文本字段的地方创建新单元格。 Is it possible to have a permanent console window, eg at the bottom of the window?是否有可能有一个永久控制台 window,例如在 window 的底部?
Thanks!谢谢!
你可以启动一个连接到同一个IPython内核的Jupyter qt控制台http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Connecting%20with%20the%20Qt%20Console.html
I don't know about a terminal in a cell, but you can open a new tab that has (only) a terminal in it. 我不知道单元格中的终端,但是你可以打开一个新的选项卡,其中只有一个终端。 There is an option in the upper right menu of the file browser: 文件浏览器右上角的菜单中有一个选项:
You have to install the package terminado
, and it only works on unix. 你必须安装包terminado
,它只适用于unix。
From the documentation there are two alternatives and steps are the followings: 从文档中有两种选择,步骤如下:
In your jupyther notebook
run the following magic command in a cell: 在你的jupyther notebook
中,在单元格中运行以下魔术命令:
%qtconsole %qtconsole
It will start a new ipython qtconsole. 它将启动一个新的ipython qtconsole。
In your jupyther notebook
run the following magic command in a cell: 在你的jupyther notebook
中,在单元格中运行以下魔术命令:
%connect_info %connect_info
The output will be something like this: 输出将是这样的:
{
"stdin_port": 234,
"ip": "127.0.0.1",
"control_port": 324234 ,
"hb_port": 50698,
"signature_scheme": "hasgd6",
"key": "8d91ba69-fasdfasdgadga6e34",
"kernel_name": "",
"shell_port": 6****9,
"transport": "tcp",
"iopub_port": 3***0
}
Paste the above JSON into a file, and connect with:
$> jupyter <app> --existing <file>
or, if you are local, you can connect with just:
$> jupyter <app> --existing kernel-773f517f-bf26-4102-9329-888a2dac0f4e.json
or even just:
$> jupyter <app> --existing
if this is the most recent Jupyter kernel you have started.
Write in your terminal the solution that fits your needs. 在终端中写入符合您需求的解决方案。 For example, I'm using it locally and I want a qtconsole: 例如,我在本地使用它,我想要一个qtconsole:
jupyter qtconsole --existing kernel-773f517f-bf26-4102-9329-888a2dac0f4e.json jupyter qtconsole - 现有kernel-773f517f-bf26-4102-9329-888a2dac0f4e.json
This will open a qtconsole
using the same kernel, so you will have access to all the variables. 这将使用相同的内核打开qtconsole
,因此您可以访问所有变量。
You can use JupyterLab. 您可以使用JupyterLab。
This brings notebook, console, terminal together in a single interface just like R-Studio. 这将笔记本电脑,控制台,终端整合在一个界面中,就像R-Studio一样。 JupyterLab JupyterLab
This solution worked for me though.这个解决方案虽然对我有用。 Type the below commands in this order.按此顺序键入以下命令。
These steps worked for me.这些步骤对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.