我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
当前回答
Windows 10:
寻找木星笔记本快捷方式(在开始菜单>Anaconda)。 右键单击“属性”。 如截图所示,添加你想要的路径(但使用/ not \ for path):
其他回答
下面是我遇到的同样问题是如何解决的。我为解决这些问题所采取的大部分步骤已经在其他人之前提供的解决方案中描述过了。
有两种方式启动Jupyter笔记本应用程序
来自水蟒航海家 使用快捷方式(名称:Jupyter Notebook)到Jupyter Notebook应用程序。在Windows操作系统中,通常可以在以下文件夹中找到: C:\Users\ AppData\漫游\Microsoft\Windows\开始菜单\程序\Anaconda3(64位)
有不同的方式配置Jupyter笔记本应用程序,以保存笔记本在一个文件夹,而不是默认的。
如果使用蟒蛇导航器发射笔记本电脑
在使用Anaconda导航器来启动Jupyter笔记本应用程序的情况下,配置的方法是取消注释“c.NotebookApp”。“jupyter_notebook_config.py”中的“Notebook_dir”字段,并添加路径。更新后的字段看起来像: c.NotebookApp。notebook_dir = <此处输入绝对路径>
在Windows的情况下,当Anaconda为特定用户安装时,该文件位于C:\Users\<USERNAME>.jupyter。
如果你找不到”。“Jupyter”文件夹,然后执行以下步骤来创建它
运行anaconda命令提示符 在命令提示符下运行"jupyter notebook——generate-config"
如果使用快捷方式(名称:Jupyter Notebook)来启动Jupyter Notebook应用程序
如果你检查这个快捷方式的目标框中的命令,你会注意到Notebook应用程序是通过执行文件“C:\Users\<USERNAME>\Anaconda3\Scripts\ jupyter-notebook-script.py”来启动的,该文件接受一个路径参数。
定义笔记本文件保存位置的基本方法是——>,用于在启动Jupyter notebook应用程序时提供所需文件夹的路径。这可以通过两种方式实现:
创建一个指向所需文件夹的环境变量,并将其用作参数 在快捷方式本身中定义绝对路径
遵循以下步骤:(注意:用实际文本替换尖括号中的文本)
Locate the shortcut "Jupyter Notebook". When Anaconda was installed for a particular user (during installation the choice selected was for the user only) the shortcut (Name: "Jupyter Notebook", Type: Shortcut) resided in "C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)" Right click on the shortcut and select "Properties" In the "Target" box locate C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %USERPROFILE% Replace "%USERPROFILE%" with a. Either: the environment variable created to point to the folder where you want to store the notebook files. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %<ENVIRONMENTVARIABLE>% b. OR: the absolute path to the work folder you want the notebook files to be stored in. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py <F://folder//subfolder> Replace the text (path) in "Start In" box with: a. Either: the environment variable created to point to the folder where you want to store the notebook files. The text in "Start In" box will look like: %<ENVIRONMENTVARIABLE>% b. OR: the absolute path to the work folder you want the notebook files to be stored in. The text in "Start In" box will look like: <F://folder//subfolder>
注意1:如果路径中有空格,那么整个路径应该用双引号括起来。
注2:此解决方案中的路径适用于为特定用户(而不是所有用户)在Windows上安装Anaconda 3(和Jupyter 3)的情况。
我个人更喜欢定义环境变量,而不是在快捷方式中硬编码路径。
I've just installed Anaconda on Windows 10 and have been trying to configure Jupyter to open in my specified directory, including updating the Jupyter config file as suggested above. This didn't work. After viewing other threads, I stumbled on file "notebook.bat" in the .anaconda\scripts\ folder. This launches Jupyter. I took a copy of the .bat file into the folder I want to work in, ran it, and voila - Jupyter launches in that folder and I no longer see every folder on my PC, just the one I want. One desktop shortcut later and I'm a happy 'non-techy'. I hope this helps.
这就是我在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就会亮起来,包裹就会放进去 父文件夹将可用。
截至2020年,对于Windows…
配置是用于miniconda的安装,但对于anaconda也是一样的。可以通过查看快捷方式的属性来修改它。链接的目标格式如下:
{1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88
分为三个部分:
1:第一部分启动包装器
C: \用户\ A_User \ miniconda3 \ python . exe C: \用户\ A_User miniconda3 \ cwp . py
这个包装器确保第三部分(即实际的快捷方式)可以使用适当的配置执行,具体取决于选择的执行环境。代码在这里。
2:脚本文件夹的路径
脚本位于每个环境使用的文件夹的子文件夹Scripts中。给出所需环境的路径,包装器将完成其余工作。在我的情况下,我使用的基础环境:
C: \用户\ A_User \ miniconda3
这个片段被传递给脚本,该脚本将其标识为变量前缀,从变量计算出的完整路径,然后添加到环境变量path的开头,并替换CONDA_PREFIX的当前内容。
3:要执行的命令
这是前面的包装器要处理的命令:
C:用户\A_User\ python.exe:\用户\A_User\ \ scription \ ju_script .py“%用户资料%\文件文件\Jupyter”
它运行Python和Jupyter -notebook-script.py脚本来启动Jupyter notebook,并添加了特定的初始文件夹“%USERPROFILE%\Documents\Jupyter”,这对应于我用来存储笔记本文件的位置。这条路就是你要的。
路径可以根据使用和存储环境的特定配置和首选项进行调整。