安装Anaconda3-5.0.1后,发现自带jupyter notebook,打开发现默认目录为C:\User\用户名。试图为更改为自己的用户目录。
百度后发现很多修改方法。
尝试方法一(失败):在命令提示符中运行jupyter notebook -generate-config(由于安装时看到了安装程序中添加到系统路径 No recommend,在运行时发现找不到命令,在Anaconda Prompt运行即可,影响不大),然后修改在C:\Users\用户名\.jupyter中生成的jupyter_notebook_config.py,将#c.NotebookApp.notebook_dir = ''修改为c.NotebookApp.notebook_dir = '自己的路径',其中路径的正斜杠/、反斜杠\、双反斜杠\\均尝试,改完后试过重启,打开后home路径仍未改变。
尝试方法二(失败):将快捷方式起始位置改为工作目录。
再行谷歌,在官方文档中发现描述
3.1.1. Change Jupyter Notebook startup folder (Windows)
Copy the Jupyter Notebook launcher from the menu to the desktop.
Right click on the new launcher and change the Target field, change %USERPROFILE% to the full path of the folder which will contain all the notebooks.
Double-click on the Jupyter Notebook desktop launcher (icon shows [IPy]) to start the Jupyter Notebook App, which will open in a new browser window (or tab). Note also that a secondary terminal window (used only for error logging and for shut down) will be also opened. If only the terminal starts, try opening this address with your browser: http://localhost:8888/.
原文网址 http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html#change-jupyter-notebook-startup-folder-windows
在方法二的基础上再将快捷方式中的目标一栏最后一个%USERPROFILE%改为自己的路径,成功解决问题。