Introduction
When working on Python projects in VS Code, it is important to open the correct project folder to keep files organized. Opening a folder allows you to use the integrated terminal, manage virtual environments, and work with version control.
Step 1: Open a Folder in VS Code
- Launch VS Code.
- Click File → Open Folder (Windows/Linux) or Open… (macOS).
- Browse and select the folder containing your Python project.
- Click Select Folder (Windows/Linux) or Open (macOS).
Step 2: Open a Folder Using the Command Line
You can also open a folder in VS Code directly from the terminal.
- Open a terminal (
Command Prompt
on Windows,Terminal
on macOS/Linux). - Navigate to your project folder using
cd
. Example:cd path/to/your/project
. - Run the following command to open VS Code in the current directory:
code .
Step 3: Ensure the Folder is Opened Correctly
- Check the Explorer panel on the left side of VS Code to confirm your files appear.
- Use
Ctrl + `
(backtick) in Windows/Linux orCmd + `
in macOS to open the terminal in the same directory. - If the wrong folder is open, repeat Step 1 to select the correct directory.
Final Thoughts
Opening a project folder correctly in VS Code is essential for an organized workflow. Whether using the menu or the command line, selecting the right folder ensures smooth navigation and easy execution of Python scripts.
Next Step: Learn how to run your first Python script in VS Code in our next guide: How Do I Run My First Python Script?