【发布时间】:2018-11-07 11:00:43
【问题描述】:
我可以在打开的 jupyterlab(或 jupyternotebook)会话中运行 shell 命令,并在 shell 命令前加上感叹号,如下所示:
!mkdir /new_folder
这个,以及其他命令,如ls 和pwd 都可以工作,但如果我尝试使用cd 更改目录,如下所示
!cd /path/to/mydir
这不起作用,我注意到当前工作目录将始终是保存我的 jupyter notebook (.ipynb) 的目录。
如果我这样做也很奇怪:
!cd /path/to/mydir && pwd
我会打印出/path/to/mydir,但如果在下面的单元格上我会打印出来
!pwd
我将获得保存我的 jupyternotebook 的当前目录,即显然我最终无法在 jupyternotebook 中使用!cd 更改工作目录。
有谁知道问题出在哪里?
【问题讨论】:
标签: python-3.x jupyter-notebook ipython