我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
当前回答
对于Windows用户,这里有一个片段,让你右键单击文件夹并打开Jupyter实验室。
def add_jupyter_to_context_menu(self):
import winreg
key = winreg.HKEY_CURRENT_USER
command_value = rf'cmd.exe /k jupyter lab --notebook-dir="%V"'
handle = winreg.CreateKeyEx(key, "Software\Classes\directory\Background\shell\Open with JupyterLab\command", 0,
winreg.KEY_SET_VALUE)
winreg.SetValueEx(handle, "", 0, winreg.REG_SZ, command_value)
# You need to download the icon yourself, or leave this part out for no icon
icon_value = fr"C:\some_folder\jupyter_icon.ico"
handle = winreg.CreateKeyEx(key, "Software\Classes\directory\Background\shell\Open with JupyterLab", 0,
winreg.KEY_SET_VALUE)
winreg.SetValueEx(handle, "icon", 0, winreg.REG_SZ, icon_value)
def remove_jupyter_from_context_menu(self):
import winreg
key = winreg.HKEY_CURRENT_USER
winreg.DeleteKey(key, "Software\Classes\directory\Background\shell\Open with JupyterLab\command")
winreg.DeleteKey(key, "Software\Classes\directory\Background\shell\Open with JupyterLab")
其他回答
这就是我在Windows上为Jupyter/Anaconda所做的。这个方法 还传递给jupyter一个python配置脚本。我用它来添加一个路径到我的项目父文件夹:
在某个地方创建jnote.bat:
@echo off
call activate %1
call jupyter notebook "%CD%" %2 %3
pause
在同一个文件夹中创建一个windows快捷方式jupyter-notebook
TARGET: D:\util\jnote.bat py3-jupyter --config=jupyter_notebook_config.py
START IN: %CD%
将jupyter图标添加到快捷方式。
在jupyter projects文件夹中执行以下操作:
创建jupyter_notebook_config.py,把你喜欢的东西放在这里:
import os
import sys
import inspect
# Add parent folder to sys path
currentdir = os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
os.environ['PYTHONPATH'] = parentdir
然后粘贴jupyte -notebook快捷方式。双击 快捷键和你的jupyter就会亮起来,包裹就会放进去 父文件夹将可用。
打开Anaconda提示符并写入打开G盘jupyter notebook文件夹——notebook-dir“G:”没有“=”
如果您正在使用jupyter lab并希望修改配置文件,则需要更新的参数为:
c.ServerApp。Root_dir = /path/to/directory/you/want
经过多次尝试,我终于做到了。下面是我提到的最简单的步骤:
Right click on the jupyter launcher icon from start menu or desktop or anaconda navigator Now you need to change 2 things on the screen: Add your path to both target and start in the properties window Caveats: a. Your path needs to be in the same drive as the drive in which jupyter is installed. Since mine was in C drive, I used the following path "C:/JupyterWorkLibrary" b. For target, at the end of the existing path, i.e, after sript.py", add this after a space. Some people have mentioned removing %USERPROFILE% from target. I did not come across this. Image for jupyter properties c. For start in, add the same path. I have used a path without spaces to avoid issues. I would also suggest stick to using path in double quotes anyways d.I have also used forward slashes in the path Now just launch the notebook. It should open into the right folder.
希望这能有所帮助。
PS:我确信还有其他的方法,这对我来说很有效。我甚至不确定上面提到的约束条件。只是有了这些步骤,我可以完成我的工作。
Windows 10:
寻找木星笔记本快捷方式(在开始菜单>Anaconda)。 右键单击“属性”。 如截图所示,添加你想要的路径(但使用/ not \ for path):