Jupyter notebook jupyter CLI参数的正确用法?

Jupyter notebook jupyter CLI参数的正确用法?,jupyter-notebook,jupyter,Jupyter Notebook,Jupyter,免责声明:我使用的是jupyter内核,但这个问题也与jupyter笔记本有关 根据jupyter内核--help all,我应该能够通过设置一个名为--KernelManager.connection_file的参数来更改jupyter内核JSON连接文件 如果我理解正确,这意味着以下命令: jupyter kernel --KernelManager.connection_file=connection.json 应该启动一个内核并给我一个名为connection.json的连接文件 然而

免责声明:我使用的是
jupyter内核
,但这个问题也与
jupyter笔记本
有关

根据jupyter内核--help all,我应该能够通过设置一个名为
--KernelManager.connection_file
的参数来更改jupyter内核JSON连接文件

如果我理解正确,这意味着以下命令:

jupyter kernel --KernelManager.connection_file=connection.json
应该启动一个内核并给我一个名为connection.json的连接文件

然而,我得到的是:

→ jupyter kernel --KernelManager.connection_file='test-this-thing.json'
[KernelApp] Starting kernel 'python3'
[KernelApp] Connection file: /Users/me/Library/Jupyter/runtime/kernel-1e65d0fe-bf8e-1234-8208-463bd4a1234a.json
现在,jupyter没有抱怨我传递了一个错误的参数或任何东西,它只是没有更改连接文件


我做错什么了吗?如何正确更改连接文件名?

基本上,您在上述代码中所做的任何操作都没有错误。以前,内核用硬编码的文件位置覆盖您设置为连接文件的任何内容

现在已根据以下拉取请求修复此问题:

    • 删除了kernelapp initialize方法上的静态连接文件名声明
    • 设置默认连接文件,使其保留现有配置

设置连接文件的有用解决方法是不要直接调用jupyter内核,而是使用内核管理器模块,它更灵活:

python -m ipykernel_launcher -f ~/kernels/file.json

上述工作为Juyyter的当前版本和以前版本,所以我认为它更可靠。< /P>