我试着按照Jupyter笔记本文档上的说明去做。

不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?

我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。


当前回答

这就是我在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就会亮起来,包裹就会放进去 父文件夹将可用。

其他回答

我用的是Windows 10,不过是同一个版本的Anaconda。

Click on the Start Menu, then All Programs (just Programs for Win10) Click on the Anaconda3 folder; mine is Anaconda3 (64-bit) In there you should see Jupyter Notebook. If you have a virtual environment installed, it will be followed by the environment name like this: Jupyter Notebook (env) Right-click Jupyter Notebook entry and navigate to More => Open File Location Right-click the correct Jupyter Notebook entry, then click on Properties Enter a path in the Start in: box; if the path has spaces in it, you must enclose it in double quotes Delete "%USERPROFILE%" at the end of the executable path

你可以像这样制作windows bat文件。

D: (your dexired drive)
cd \Your\Desired\Start\Derectory
Jupyter notebook

保存为“JupyterNB.bat”(或任何你喜欢的),并双击它。

一个不错的技巧是在Windows资源管理器中导航到你想要的开始文件夹:

点击文件 单击打开命令提示符 然后只需输入“jupyter notebook”并按enter键

很快就会弹出一个web浏览器,并显示正确的开始文件夹。

首先试着跑步

jupyter notebook——notebook-dir="C:/您的/需要的/开始目录/"

在命令行(cmd)中查看Jupyter笔记本是否在所需的位置打开。

如果是,那么您可以通过以下方式使其成为一个快捷方式:

在Windows文件资源管理器或桌面上,右键单击>新建>快捷方式 输入以下位置,然后单击下一步:

jupyter notebook——notebook-dir="C:/您的/需要的/开始目录/"

为您的快捷方式输入一个名称并完成

现在你有一个快捷方式启动Jupyter在你想要的位置。这适用于Windows 7、macOS和Linux。 对于windows,最好用双引号将路径括起来,因为如果路径名中有空格,单引号将不起作用

注意,如果您发现错误提示路径无效,请尝试在路径中使用普通斜杠/而不是反斜杠\,例如 jupyter笔记本——notebook-dir="D:/"

这是我为Windows 10 Anaconda Navigator找到的解决方案。

步骤1:搜索Jupyter Notebook并导航到文件位置。大致如下

步骤2:右键单击Jupyter Notebook,选择属性。将您的目录添加到Target。我的是D:\教育\机器学习

步骤3:不要从Anaconda Navigator中启动Jupyter Notebook。请使用上面的快捷方式。