Python Setup
Learn how to install Python, set up VS Code, and configure your development environment like a pro.
Learn how to install Python, set up VS Code, and configure your development environment like a pro. This hands-on tutorial focuses on practical implementation of python setup concepts.
Setting Up Your Environment
To start programming in Python effectively, you need the right tools. We will set up Python (the language) and Visual Studio Code (the editor).
1. Install Python
- Go to python.org/downloads.
- Download the latest version for your OS (Windows/Mac/Linux).
- CRITICAL STEP: Run the installer and check the box "Add Python to PATH".
[!IMPORTANT] Why Add to PATH? If you don't check this box, your computer won't know where to find the
pythoncommand. You'll get errors like'python' is not recognized.
Troubleshooting: "Python not found"
If you installed Python but the command isn't working:
- Uninstall Python.
- Run the installer again.
- Make sure to check "Add Python to PATH" at the very bottom of the first screen.
2. Install VS Code
Visual Studio Code (VS Code) is the industry-standard code editor.
- Download it from code.visualstudio.com.
- Install and open it.
Recommended Extensions
To make VS Code powerful for Python, install these extensions (click the "Extensions" icon on the left sidebar):
| Extension | Why you need it |
|---|---|
| Python (Microsoft) | Essential support, debugging, and IntelliSense. |
| Pylance | Super-fast autocompletion and type checking. |
| Prettier | Formats your code automatically to look clean. |
| Material Icon Theme | Makes your file icons look great. |
3. Verify Installation
Let's check if everything is working. Run this code to see your Python version.
4. Virtual Environments (Best Practice)
In the real world, developers use Virtual Environments to keep projects separate. Think of it as a separate box for each project so their libraries don't conflict.
How to use them:
# 1. Create a virtual environment named 'venv'
python -m venv venv
# 2. Activate it (Windows)
venv\Scripts\activate
# 2. Activate it (Mac/Linux)
source venv/bin/activate
You'll know it's active when you see (venv) at the start of your terminal line.
AI Mentor
Confused about "Setting up Python development environment and virtual environments"? Ask our AI mentor for a simplified explanation.
Quiz
Quiz
Question 1 of 5What happens if you forget to 'Add Python to PATH'?
Key Takeaways
✅ Add to PATH is the most critical installation step.
✅ VS Code + Python Extension is the pro setup.
✅ Virtual Environments keep your projects clean and organized.
✅ Always verify your installation with a simple script.
What's Next?
Setup complete! 🎉 In the next lesson, we will write your First Python Program and learn about comments and printing.
Keep coding! 🚀