The Workshop
You are now a skilled wizard! But a true wizard doesn't just cast spells in the training grounds (browser). They have their own Workshop (Local Environment).
To code on your own computer, you need two things:
- Python Interpreter: The engine that runs code.
- IDE (Integrated Development Environment): The tool where you write code (like VS Code or PyCharm).
Virtual Environments
Imagine if all your potions mixed together... disaster!
In Python, we use Virtual Environments (venv) to keep each project's spells separate.
# Windows python -m venv .venv # Mac / Linux python3 -m venv .venv
Your Mission
Since we are in the browser, we will simulate the setup.
Create a variable install_cmd and set it to the string "python -m venv .venv".
Create a variable best_ide and set it to "VS Code" (or your favorite).
Print both variables to "run" the setup.
Suggested SolutionClick to expandClick to collapse
Now you know the secret command! Go forth and install Python on your machine!
install_cmd = "python -m venv .venv"
best_ide = "VS Code"
print("Running:", install_cmd)
print("Opening:", best_ide)Advanced TipsWant more? Click to expandClick to collapse
After creating the environment, you need to activate it.
- Windows:
.venv\\Scripts\\activate - Mac/Linux:
source .venv/bin/activate
Deep Dive
This lesson was just a simulation. To build a real workspace, check out these trusted guides:
- VS Code Official Tutorial: Getting Started with Python in VS Code (Highly Recommended)
- Virtual Environments: Python Virtual Environments: A Primer (Real Python)