🐸

The Workshop

Python Basicspython-basics-34-the-workshop
Reward: 100 XP
|

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:

  1. Python Interpreter: The engine that runs code.
  2. 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

1
Simulation

Since we are in the browser, we will simulate the setup.

2
Command

Create a variable install_cmd and set it to the string "python -m venv .venv".

3
IDE

Create a variable best_ide and set it to "VS Code" (or your favorite).

4
Print

Print both variables to "run" the setup.

Suggested Solution
Click to expand

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 Tips
Want more? Click to expand

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:

pymain.py
Loading...
Terminal
Terminal
Ready to run...