改变jupyter notebook默认初始文件路径

jupyter notebook home path changing - %USERFROFILE% and Configure file

如何改变jupyter notebook默认初始文件路径,网上都提供了很多方法。Link1 , Link2

但他们都没让你这样测试:

[Win] + R , "cmd", 在windows命令行运行:

C:/ProgramData/Anaconda3/python.exe C:/ProgramData/Anaconda3/Scripts/jupyter-notebook-script.py

注:如果这样测试可以修改,而通过开始菜单双击“Jupyter Notebook”快捷方式还是没改过来,那就往下看。

他们都忽略了一个问题:在 Jupyter Notebook 快捷方式 - 属性 - Shortcut Tag- Target 栏内的内容,会影响你修改的效果。

即:可能你已经改了以下文件:

  • C:Users<username>.jupyterjupyter_notebook_config.py
  • 并把快捷方式里Start In内改成了你要的path: C:Users<username><your_preferred_path>

还是可能不生效,原因就是 Target 里的%USERFROFILE%或别的内容在使改动不生效。

我的Target内内容:

"C:/ProgramData/Anaconda3/python.exe" "C:/ProgramData/Anaconda3/Scripts/jupyter-notebook-script.py"

-----

Nov 2, 2017 Updated:

1. Install Anaconda 5
2. add the path of "jupyter notebook.exe" into Environment Varialble: "path"
make sure you can launch jupyter notebook by: launching cmd command: "jupyter notebook"
3. in cmd window, cd to the path that you want to create the configure file "jupyter_notebook_config.py"
you will get: Writing default config to: C:UsersAdministrator.jupyterjupyter_notebook_config.py"
4. modify the config file "jupyter_notebook_config.py" at line of "#c.NotebookApp.notebook_dir ='' "
as:
c.NotebookApp.notebook_dir = '<path you prefer>'
5. now you can launch jupyter notebook via cmd window. But, the shortcut is still not like you want.

---
6. modify the content in "target" in your properties of your jupyter_notebook's shortcut:
"C:/ProgramData/Anaconda3/python.exe" "C:/ProgramData/Anaconda3/Scripts/jupyter-notebook-script.py"

 OK.

原文地址:https://www.cnblogs.com/sonictl/p/7403264.html