我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
我试着按照Jupyter笔记本文档上的说明去做。
不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?
我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。
当前回答
如果你正在使用WinPython而不是anaconda,那么你需要导航到安装WinPython的目录,例如C:\WPy-3670\settings\.jupyter\jupyter_notebook_config.py
您需要编辑这个文件并找到这一行 # c.NotebookApp。Notebook_dir = "将其更改为例如。 c.NotebookApp。notebook_dir = 'D:/your_own_folder/ contains /jupyter_notes'
您还需要将反斜杠\改为正斜杠/。还要确保通过删除#来取消该行的注释
其他回答
下面是我遇到的同样问题是如何解决的。我为解决这些问题所采取的大部分步骤已经在其他人之前提供的解决方案中描述过了。
有两种方式启动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)的情况。
我个人更喜欢定义环境变量,而不是在快捷方式中硬编码路径。
所以上面的答案是有帮助的,但请允许我把它弄清楚,这样其他不太熟悉MS-Windows的人也可以用同样的方法来解决:
当Windows 10使用Python、Ipython和Jupyter Notebook安装Anaconda时,会发生此问题。
首先打开Anaconda Prompt,并在提示符中输入以下内容:
jupyter notebook --generate-config
你会得到这样的结果:
你不用再按提示做任何事了。出于隐私考虑,我没有快照我的完整地址,但它显示了如下内容:
C:\Users\name\.jupyter
在C:驱动器上找到这个文件夹,在这个文件夹中找到python文件jupyter_notebook_config.py。将文件拖到notepad++中进行编辑。 在编辑时,查看第214行,寻找如下的字符串:
#c.NotebookApp.notebook_dir = ''
取消注释,即删除第一列中的“#”。现在将目标文件夹地址添加到' '中,如下所示:
c.NotebookApp.notebook_dir = 'C:\\Users\\name\\Desktop\\foldername'
然后保存文件。然后再次打开蟒蛇提示,输入jupyter notebook。这应该启动Jupyter笔记本在浏览器的文件夹与上述地址。这里的关键是UNCOMMENT(意思是删除)行前面的#,然后在文件夹之间使用\\双斜杠(作为路径分隔符)。如果您只使用单个斜杠\,它将不起作用。
这是所有。
CD导入目录或父目录(与打算的目录将工作嵌套在其中)。
注意它必须是一个文件夹(E:\>—这将不起作用)
然后运行命令jupyter notebook
经过多次尝试,我终于做到了。下面是我提到的最简单的步骤:
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:我确信还有其他的方法,这对我来说很有效。我甚至不确定上面提到的约束条件。只是有了这些步骤,我可以完成我的工作。
首先试着跑步
jupyter notebook——notebook-dir="C:/您的/需要的/开始目录/"
在命令行(cmd)中查看Jupyter笔记本是否在所需的位置打开。
如果是,那么您可以通过以下方式使其成为一个快捷方式:
在Windows文件资源管理器或桌面上,右键单击>新建>快捷方式 输入以下位置,然后单击下一步:
jupyter notebook——notebook-dir="C:/您的/需要的/开始目录/"
为您的快捷方式输入一个名称并完成
现在你有一个快捷方式启动Jupyter在你想要的位置。这适用于Windows 7、macOS和Linux。 对于windows,最好用双引号将路径括起来,因为如果路径名中有空格,单引号将不起作用
注意,如果您发现错误提示路径无效,请尝试在路径中使用普通斜杠/而不是反斜杠\,例如 jupyter笔记本——notebook-dir="D:/"