当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
运行ipython之前:
将目录更改为您的首选目录 运行ipython
运行ipython后:
使用%cd /输入/your/ preferred /path/here/ 使用%pwd检查当前目录
其他回答
在Windows下MiniConda2/Anaconda2上修改Jupyter或iPython工作目录,可以修改此文件:
C:\Program Files\Miniconda2\cwp.py
并添加项目文件夹位置:development_folder= 'C:\Users\USERNAME\Development' 这是我的用户名\开发在我的情况下。
还需要将:os.chdir(documents_folder)更改为os.chdir(development_folder)
try:
documents_folder = get_folder_path(FOLDERID.Documents)
development_folder= 'C:\Users\USERNAME\Development'
except PathNotFoundException:
documents_folder = get_folder_path(FOLDERID.PublicDocuments)
os.chdir(development_folder)
subprocess.call(args, env=env)
通过使用常规的Jupiter Notebook快捷键来执行。
在Windows上的iPython Notebook中,这对我来说很有效:
cd d:\folder\
Windows 10
Look for the jupyter_notebook_config.py in C:\Users\your_user_name\.jupyter or look it up with cortana. If you don't have it, then go to the cmd line and type: jupyter notebook --generate-config Open the jupyter_notebook_config.py and do a ctrl-f search for: c.NotebookApp.notebook_dir Uncomment it by removing the #. Change it to: c.NotebookApp.notebook_dir = 'C:/your/new/path' Note: You can put a u in front of the first ', change \\\\ to /, or change the ' to ". I don't think it matters. Go to your Jupyter Notebook link and right click it. Select properties. Go to the Shortcut menu and click Target. Look for %USERPROFILE%. Delete it. Save. Restart Jupyter.
对上面的Windows技巧的一个更简单的修改-不需要硬编码目录。
A)创建一个包含以下内容的批处理文件: 注意:批处理文件是一个简单的文本文件,其中包含可以执行的命令 在CMD窗口中运行。它必须有一个'.bat'扩展名,因此… 你需要禁用隐藏已知类型扩展名的文件夹设置)
rem -- start_ipython_notebook_here.bat ---
dir
ipython notebook
pause
B)复制并粘贴批处理文件到任何你想要启动笔记本服务器的文件夹。
(确保它是一个你有权限编辑的文件夹。“C:\”不是一个好的选择。)
C)在Windows资源管理器中双击批处理文件。
笔记本服务器应该像往常一样启动。
This might help someone who doesn't want to change config file. If you are on Windows/ using Anaconda3, go to Win Start ->Search for Jupyter Notebook(env). Click on it and the Jupyter opens up. On Jupyter webpage, on right hand side go to New -> Terminal and the terminal window opens up. In this terminal windows change the directory to the working directory, using cd command. Example: cd "c:\User\<user-name>\workingdir". Now in the same terminal window type Jupyter-notebook, this will open Jupyter with the working directory we used in cd command above.