Are you ready to dive into Python but not sure how to set everything up? Whether you're completely new or just switching machines, this beginner-friendly guide will walk you through the entire setup process - from installing Python to writing and running your very first Python script using Visual Studio Code (VS Code).
Let’s get started step-by-step. By the end of this guide, you’ll have everything ready to start coding in Python.
✅ Step 1: Install Python on Your System
Python is an interpreted language, which means:
- It first compiles your code into bytecode.
- Then executes it using the Python Virtual Machine.
So, we need to install the Python interpreter first.
🔗 Download Python
- Go to the official Python website: https://www.python.org/downloads
- Click on the latest stable version (e.g., Python 3.13.x).
- Run the downloaded installer.
⚠️ IMPORTANT: Add Python to PATH
During installation, check the box that says:
✅ Add Python to PATH
This is crucial, as it allows you to use Python from the terminal (Command Prompt or VS Code Terminal).
Once installed, you can verify Python installation by opening your terminal and typing:
python --version
If installed correctly, you’ll see something like:
Python 3.13.5
✅ Step 2: Set Up VS Code (Your Python IDE)
While there are many IDEs like PyCharm, VS Code (Visual Studio Code) is lightweight, fast, and highly customizable - perfect for beginners.
🔽 Download and Install VS Code
- Download from: https://code.visualstudio.com/
- Install it like any regular app.
🧩 Install Python Extension for VS Code
Once you open VS Code:
- Go to the Extensions tab (left sidebar or press
Ctrl + Shift + X
). - Search for "Python" (by Microsoft).
- Click Install.
This extension provides:
- Syntax highlighting
- IntelliSense (auto-suggestions)
- Code linting
- Code formatting
- Python interpreter selection
- Integrated terminal support
✅ Step 3: Configure the Python Interpreter in VS Code
After installing the Python extension:
- Open the Command Palette (
Ctrl + Shift + P
). - Type and select:
Python: Select Interpreter
- Choose the latest installed version of Python.
💡 Tip: If you don’t see the interpreter, restart VS Code or check if Python is added to the PATH properly.
✅ Step 4: Write and Run Your First Python Script
Let’s create a simple Python file and run it.
📝 Create Your First File
- Open a folder in VS Code (or create a new one).
- Create a new file named:
main.py
Paste this code:
# This is my first Python program
print('I like Biryani!')
▶️ Run the Script
- Option 1: Right-click inside the file and click "Run Python File in Terminal"
- Option 2: Use the shortcut
Ctrl + Alt + N
if you have the Code Runner extension installed.
You should see the output:
I like Biryani!
🎉 Congrats! You just wrote and executed your first Python program!
✅ Step 5: Bonus – Useful VS Code Extensions for Python Projects
Here are some handy extensions that’ll make your Python coding experience smoother:
Extension Name | Purpose |
---|---|
Python (Microsoft) | Required for all Python functionality |
Code Runner | Run code quickly from editor |
Pylance | Fast IntelliSense and error checking |
Jupyter | Work with .ipynb notebooks (optional) |
autoDocstring | Generate docstrings automatically |
Black Formatter | Format code with opinionated style |
You can install these from the Extensions tab just like the Python extension.
🛠️ Optional: Set Up a Virtual Environment (Best Practice)
For real projects, it's a best practice to use a virtual environment so your dependencies don’t conflict across projects.
From your project folder, run this in terminal:
python -m venv venv
Then activate it:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
You'll now see (venv)
in your terminal - you're inside the virtual environment.
🚀 Recap
Here’s what you’ve done:
- ✅ Installed Python and added it to PATH
- ✅ Installed and configured VS Code
- ✅ Installed Python extension and selected interpreter
- ✅ Created and ran your first Python script
- ✅ Learned about virtual environments and useful extensions
You're now fully set up to learn and build Python projects!
📬 Let’s Connect
🌐 Portfolio: paulanik.com
💼 LinkedIn: Anik Paul
🐙 GitHub: anikpaul99
📩 Email: hello@paulanik.com
Top comments (2)
sos the code is not working
Hi! Thanks for reading the article. Could you share a bit more about what’s not working?