Win10 Jupyter Notebook修改home路徑

安裝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%改爲自己的路徑,成功解決問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章