八度音阶的朱庇特核。
octave-kernel的Python项目详细描述
安装
使用pip安装:
pip install octave_kernel
添加--user以在用户级环境而不是系统环境中安装。
使用conda安装:
conda config --add channels conda-forge conda install octave_kernel conda install texinfo # For the inline documentation (shift-tab) to appear.
我们需要octave-cli可执行文件来运行内核。 将该可执行文件的目录添加到PATH环境变量中,或使用 OCTAVE_EXECUTABLE指向可执行文件本身。 注意,在windows的octave 5上,可执行文件位于"Octave-5.x.x.x\mingw64\bin"。
在安装 python包。可以使用jupyter kernelspec list找到此位置。 如果不需要默认位置,请删除 octave内核,并使用python -m octave_kernel install安装。见 python -m octave_kernel install --help获取可用选项。
用法
要使用内核,请运行以下命令之一:
jupyter notebook # or ``jupyter lab``, if available
# In the notebook interface, select Octave from the 'New' menu
jupyter qtconsole --kernel octave
jupyter console --kernel octave
这个内核基于MetaKernel, 这意味着它具有一组标准的魔法(比如%%html)。关于魔法的完整列表, 在单元格中运行%lsmagic。
提供了一个示例笔记本online。
配置
内核可以通过将octave_kernel_config.py文件添加到 jupyter配置路径。OctaveKernel类提供plot_settings,inline_toolkit, kernel_json,和cli_options作为可配置特征。可用的打印设置有: “格式”、“后端”、“宽度”、“高度”和“分辨率”。
cat ~/.jupyter/octave_kernel_config.py # use Qt as the default backend for plots c.OctaveKernel.plot_settings = dict(backend='qt')
八进制内核json文件的路径也可以通过创建 OCTAVE_KERNEL_JSON环境变量。
八进制的命令行选项也可以用 OCTAVE_CLI_OPTIONS环境变量。cli选项将附加到 --interactive--quiet--no-init-file的默认操作。请注意 在内核设置more off以防止 在~/.octaverc中调用寻呼机时的锁定。
内联工具包是graphics_toolkit,用于为内联生成绘图 后端。它默认为gnuplot。不同的后端可以用于内联 使用此配置或使用绘图魔法并将后端名称放在inline:之后(例如plot -b inline:fltk)来绘图。
故障排除
启动时内核超时
如果内核没有启动,请从终端运行以下命令:
python -m octave_kernel.check
这有助于诊断设置与倍频程集成的问题。如果有疑问, 创建该命令输出的问题。
内核未列出
如果内核未列为可用内核,请首先尝试以下命令:
python -m octave_kernel install --user
如果仍然没有列出内核,请验证以下内容是否指向 python版本:
which python # use "where" if using cmd.exe
which jupyter
gnuplot错误
以gnuplot> set terminal aqua enhanced title开头的错误可以通过 将setenv("GNUTERM","qt");添加到MacOS上的~/.octaverc或通过安装 gunplot-x11并使用setenv("GNUTERM", "X11")。
空白图
使用%plot -f <backend>magic或使用配置设置指定其他格式。 在某些系统上,默认的'png'会生成黑色绘图。在其他系统上'svg'产生 黑色阴谋。