You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何从任意指定位置打开Jupyter Notebook?能否在不修改默认路径的前提下单次从其他位置启动?

Hey there! Let's tackle your Jupyter Notebook startup questions step by step—super common asks, so I’ve got you covered.

一、从任意所需位置打开Jupyter Notebook

Here are a few reliable methods depending on your OS:

1. Terminal/Command Line (Cross-Platform)

This is the most flexible approach that works on Windows, Mac, and Linux:

  • Open your terminal (Command Prompt/PowerShell for Windows, Terminal for Mac/Linux)
  • Use the cd command to navigate to your target folder, e.g., cd C:\Projects\MyDataNotebooks (Windows) or cd ~/Documents/MachineLearning (Mac/Linux)
  • Type jupyter notebook and hit enter—Jupyter will launch directly from this folder, and your browser will show all files in the directory

2. Add Right-Click Option (Windows)

If you prefer point-and-click over commands, add a permanent right-click menu entry:

  • Open Registry Editor (press Win+R, type regedit, hit enter)
  • Navigate to HKEY_CLASSES_ROOT\Directory\Background\shell
  • Right-click shell, select "New > Key", name it Jupyter Notebook
  • Right-click this new key, select "New > Key", name it command
  • Double-click the "Default" value in the command key, and paste: "C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\Scripts\jupyter-notebook.exe" "%V" (replace YourUsername and PythonXX with your actual info)
  • Now right-click any empty space in a folder, and you’ll see a "Jupyter Notebook" option that launches directly from that location

3. Modify Desktop Shortcut (Windows)

If you already have a Jupyter shortcut on your desktop:

  • Right-click the shortcut, select "Properties"
  • In the "Start in" field, replace the default path with your preferred folder
  • Click "OK"—now double-clicking the shortcut will launch Jupyter from your chosen directory

4. Custom Startup Script (Mac/Linux)

Create a reusable script to launch from your favorite folder:

  • Open a text editor, paste this code (replace the path with your target folder):
    #!/bin/bash
    cd /path/to/your/favorite/folder
    jupyter notebook
    
  • Save it as start_jupyter.sh
  • In Terminal, run chmod +x start_jupyter.sh to give it execution permissions
  • From now on, double-click the script or run ./start_jupyter.sh in Terminal to launch Jupyter from your specified folder

二、仅本次从指定文件夹启动 (No Default Changes)

If you want a one-time launch from a different folder without altering your default settings, these methods work perfectly:

1. Terminal/Command Line (Quickest)

  • Open your terminal, navigate to the temporary folder using cd /path/to/temp/folder
  • Run jupyter notebook—this session will use the temporary folder, and your next normal launch will revert to the default location

2. Temporary Shortcut Edit (Windows)

  • Right-click your Jupyter shortcut, select "Properties"
  • Temporarily change the "Start in" field to your desired folder
  • Click "OK", launch Jupyter, then go back to Properties and restore the original path (or just close Properties without saving if you didn’t hit "Apply")

3. Direct Path Command (Mac/Linux)

Skip navigating with cd and launch directly with one command:

jupyter notebook --notebook-dir="/path/to/your/temp/folder"

This launches Jupyter from the specified folder once, with no impact on your default startup location

内容的提问来源于stack exchange,提问作者Manan Jain

火山引擎 最新活动