iTranslated by AI
How to Set Up a Jupyter Notebook Development Environment in VS Code
Introduction
I have set up a Jupyter Notebook development environment in VSCode, so I am recording the steps here as a memo.
I hope this will be helpful for those who are going to set up a Jupyter Notebook development environment in the future.
Prerequisites
- VSCode must already be installed.
Requirements
- VSCode (Visual Studio Code) - Please install it in advance.
- Python - Download and install it.
-
Jupyter - Install it using
pip.
Steps
1. Installing Python
If Python is not installed, please follow the steps below to install it.
Installation
Installing from the official Python website (Windows, macOS)
- Download and install the installation package from the official Python website. A Python version of 3.6 or later is recommended.
- Run the downloaded installer to install it.
- Make sure to check the "Add Python to PATH" checkbox during installation.
Installing Python using Homebrew (macOS)
-
Check if Homebrew is installed
Open the terminal and run the following command to install Python.brew -vIf it is installed, the version will be displayed.
Homebrew 4.2.15 -
If Homebrew is not installed, run the following command to install it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" -
Install Python
brew install python
Confirmation
-
Verify if Python was installed correctly
python --versionor
python3 --versionIf installed correctly, the version will be displayed.
Python 3.12.3
3. Installing VSCode Extensions
- Open VSCode and click the Extensions icon on the left side.
- Enter "Python" in the search bar and install the Python extension provided by Microsoft.

- Similarly, enter "Jupyter" and install the Jupyter extension as well.

4. Creating a Virtual Environment
By creating a virtual environment, you can manage different Python versions and packages for each project.
-
Create a directory (project directory) for the virtual environment.
If it has already been created, please skip this step.
mkdir -p ~/dev/project -
Create the virtual environment.
python3 -m venv ~/dev/project/venv -
Activate the virtual environment.
source ~/dev/project/venv/bin/activate
5. Installing Jupyter
Ensure that the virtual environment is activated and install Jupyter.
pip install jupyter
6. Opening Jupyter Notebook in VSCode
-
Open VSCode
- Open the project directory in VSCode.
code ~/dev/projectAlternatively, open VSCode and then open the project directory.
-
Create a New Jupyter Notebook:
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P). - Select "Jupyter: Create New Jupyter Notebook ".
- Open the Command Palette (
-
Select the Kernel:
- Click "Select Kernel" in the top right of the screen and select the virtual environment you created.
- If the virtual environment is correctly recognized, venv will be displayed as shown below.

7. Verifying the Environment
-
Enter the following code into a Notebook cell and try running it.
print("Hello, Jupyter!") -
If it outputs correctly, the environment setup is complete.
Summary
I have introduced the steps for setting up a Jupyter Notebook development environment in VSCode.
By combining VSCode and Jupyter Notebook, you can develop in Python more efficiently.
Discussion