1.设置让每次打开jupyter notebook时,所打开的文件路径是固定的,后面如果需要在该环境中打开某文件,只需要将某文件复制到这个保存路径文件夹中即可。
1.找到Jupyter 配置文件,打开jupyter_notebook_config.py
1.存在jupyter_notebook_config.py
①Jupyter 配置文件通常位于用户主目录下的 .jupyter
文件夹中。具体路径如下:
1.Windows:
C:\Users\<你的用户名>\.jupyter\jupyter_notebook_config.py
2.macOS/Linux:
/home/<你的用户名>/.jupyter/jupyter_notebook_config.py
②使用命令查找配置文件是否存在
1.macOS/Linux:
ls ~/.jupyter/jupyter_notebook_config.py
2.Windows(在命令提示符中):
dir C:\Users\<你的用户名>\.jupyter\jupyter_notebook_config.py
2.未找到配置文件jupyter_notebook_config.py
1.使用命令jupyter notebook --generate-config
生成配置文件
2.再根据所显示路径进入jupyter_notebook_config.py配置文件
2.修改配置文件(在文件中添加或修改)(保存后即可生效)
Windows
c.NotebookApp.notebook_dir = 'C:\\path\\to\\your\\directory'
macOS/Linux
c.NotebookApp.notebook_dir = '/path/to/your/directory'
2.不固定路径,但是需要在某个路径打开这个虚拟环境中的jupyter环境
1.激活虚拟环境
2.直接在特定路径打开jupyter notebook
①Windows
jupyter notebook --notebook-dir='C:\path\to\your\directory'
②macOS/Linux
jupyter notebook --notebook-dir='/path/to/your/directory'