问题描述
开始菜单----->Anaconda Prompt (anaconda3)
进入base环境,默认
(base) C:User>
(base) C:developpython_workspacelearn_pytorch>conda activate pytorch
在当前路径下,输入jupyter notebook,打开之后的路径应该是C:developpython_workspacelearn_pytorch,但依然是
C:User>
(pytorch) C:developpython_workspacelearn_pytorch>jupyter notebook
解决方案一:
输入 jupyter notebook + 想打开的路径
(pytorch) C:developpython_workspacelearn_pytorch>jupyter notebook C:developpython_workspacelearn_pytorch
此时 打开的是指定的路径C:developpython_workspacelearn_pytorch
解决方案二:
如果不想每次输入jupyter notebook 再额外输入路径,很麻烦,可以采取删除默认路径的方法。
默认路径存储在哪里?
打开Anaconda Prompt (anaconda3)
输入下面命令
jupyter-notebook --generate-config
出来一个文件名C:Users.jupyterjupyter_notebook_config.py,用记事本打开
(base) C:developpython_workspacelearn_pytorch>jupyter notebook --generate-config Overwrite C:Users.jupyterjupyter_notebook_config.py with default config? [y/N] (base) C:developpython_workspacelearn_pytorch>
打开提示的路径,下面是我的路径
C:Users.jupyterjupyter_notebook_config.py with default config
搜索文本内容‘directory’,大概在393行
## The directory to use for notebooks and kernels. # Default: '' c.NotebookApp.notebook_dir = 'C:\Users\Desktop\NEUCS\study\Mathmatical Modeling\jupyter\workspace'
将第三行注释掉,保存文本。
看到网上其他方法都是修改为别的位置,但是也不是每次都想打开同一位置,索性去掉默认位置。
## The directory to use for notebooks and kernels. # Default: '' #c.NotebookApp.notebook_dir = 'C:\Users\Desktop\NEUCS\study\Mathmatical Modeling\jupyter\workspace'
再次输入jyputer notebook,
(pytorch) C:developpython_workspacelearn_pytorch>jupyter notebook
此时打开的是当前路径C:developpython_workspacelearn_pytorch>,无需在jyputer notebook后面指定路径。