Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jupyter中的终端如何自动运行bash而不是sh_Jupyter - Fatal编程技术网

Jupyter中的终端如何自动运行bash而不是sh

Jupyter中的终端如何自动运行bash而不是sh,jupyter,Jupyter,我喜欢终端功能,在我们的用例中效果很好,我希望学生直接从终端做一些工作,这样他们就能体验到那种环境。自动启动的shell是sh,并且不接受我的所有bash默认值。我能输入“bash”,一切都很完美。如何将“bash”设为默认值?在Ubuntu15.10上运行Jupyter时,Jupyter shell将默认为/bin/sh,这是指向/bin/dash的符号链接 rm /bin/sh ln -s /bin/bash /bin/sh 这个修正让Jupyter终端为我启动到bash中。Jupyter

我喜欢终端功能,在我们的用例中效果很好,我希望学生直接从终端做一些工作,这样他们就能体验到那种环境。自动启动的shell是sh,并且不接受我的所有bash默认值。我能输入“bash”,一切都很完美。如何将“bash”设为默认值?

在Ubuntu15.10上运行Jupyter时,Jupyter shell将默认为/bin/sh,这是指向/bin/dash的符号链接

rm /bin/sh
ln -s /bin/bash /bin/sh

这个修正让Jupyter终端为我启动到bash中。

Jupyter使用环境变量
$SHELL
来决定启动哪个SHELL。如果您正在使用init运行jupyter,那么在Ubuntu系统上将设置为dash。我的解决方案是在启动jupyter的脚本中导出SHELL=/bin/bash。

我尝试了切换系统范围的SHELL环境变量的最终方法,在文件/etc/environment中添加以下行:

这在Ubuntu环境下工作。每隔一段时间,SHELL变量总是在重启后指向终端中的/bin/bash,而不是/bin/sh

此外,设置CRON作业以在系统启动时启动jupyter notebook在jupyter notebook的终端上引发了同样的问题

事实证明,我需要通过命令$crontab-e在CRON job语句中包含Bash init文件的变量设置和寻源语句,如~/.bashrc,如下所示:


通过这种方式,我可以通过远程web浏览器()登录Ubuntu服务器,并将jupyter notebook的终端默认值打开为Bash,与本地环境相同。

您可以将其添加到您的jupyter_notebook_config.py

c.NotebookApp.terminado_settings = {'shell_command': ['/bin/bash']}

我想它应该选择你的默认外壳。如果你打开一个普通的终端,你会得到什么样的shell?使用ssh,我会得到bash。我应该找到它,你修过吗?如果是这样的话怎么办?由于某种原因,这对我不起作用,你知道为什么吗?我已经在/etc/profile和/etc/environment中设置了这个,但我仍然有同样的问题,有什么想法为什么?
    @reboot source /home/USERNAME/.bashrc && \
            export SHELL=/bin/bash && \
            /SOMEWHERE/jupyter notebook --port=8888
c.NotebookApp.terminado_settings = {'shell_command': ['/bin/bash']}