0% found this document useful (0 votes)
3 views3 pages

Beginner Python Venv VSCode Setup

This guide provides a step-by-step process for setting up a Python project in Visual Studio Code, including creating a project folder and a virtual environment. It outlines commands for different operating systems to create and activate the virtual environment. Finally, it advises on creating a Python file and running it in the terminal, along with a tip to install the Python Extension for enhanced coding support.

Uploaded by

appushetty072
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Beginner Python Venv VSCode Setup

This guide provides a step-by-step process for setting up a Python project in Visual Studio Code, including creating a project folder and a virtual environment. It outlines commands for different operating systems to create and activate the virtual environment. Finally, it advises on creating a Python file and running it in the terminal, along with a tip to install the Python Extension for enhanced coding support.

Uploaded by

appushetty072
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Project Setup Guide

A simple step-by-step guide to setting up VS Code and creating your first Virtual
Environment.

1. Create Your Project Folder

First, we need to create a dedicated folder on your computer where all your project files will live.

STEP 1

Open your Terminal (Mac/Linux) or Command Prompt (Windows), type the following commands,
and press Enter:

mkdir my_first_project
cd my_first_project

STEP 2

Open this new folder inside Visual Studio Code with this quick shortcut command:

code .

(Alternatively, you can just open VS Code manually, go to File -> Open Folder, and select your
my_first_project folder.)

2. Create a Virtual Environment

A virtual environment is like an isolated sandbox for your project. It makes sure that the packages
you install for this project do not mess up other projects on your computer.

Python Beginner Guides Page 1


STEP 3

Inside VS Code, open the built-in terminal by pressing Ctrl + ` (or go to Terminal -> New
Terminal at the top menu).

Run the command corresponding to your operating system to create your environment named
venv :

💻 For Windows:

python -m venv venv

🍎 For Mac / Linux:

python3 -m venv venv

3. Activate the Virtual Environment

Before you start writing code or installing packages, you must turn on (activate) your virtual
environment sandbox.

STEP 4

In the exact same terminal window, type the activation command:

💻 For Windows:

venv\Scripts ctivate

🍎 For Mac / Linux:

source venv/bin/activate

💡 How to know it worked:


Once activated, you will see (venv) appear at the very beginning of your terminal text line. It
looks something like this:
(venv) C:\my_first_project>

4. Ready to Code!

STEP 5

Create a new file in VS Code named [Link] , write your code, and run it directly in your terminal:

python [Link]

Python Beginner Guides Page 2


🔌 Quick Pro-Tip for VS Code:
When you open a .py file, VS Code might show a pop-up window in the bottom right corner
suggesting to install the official Python Extension. Always click Install—it gives you code auto-
completion and highlights syntax errors to make coding easier!

Python Beginner Guides Page 3

You might also like