2. Setting Up Your Python Environment
Why You Need a Coding Environment
Now that Python is installed, let's set up a comfortable place to write code. This is where we’ll spend most of our time. The tool we use is called an IDE (Integrated Development Environment) or code editor.
Choose Your Editor
You can use any editor you like, but these two are **beginner-friendly and powerful**:
| Editor | Why Choose It? |
|---|---|
| VS Code (Recommended Lightweight Option) | Fast, customizable, works for many languages, great extensions |
| PyCharm (Beginner Friendly Setup) | Comes pre-configured for Python, smart auto-complete, good for large projects |
✅ Tip: If you're not sure what to choose, go with **VS Code**. If you want everything configured automatically for Python, choose **PyCharm**.
Option 1: Set Up VS Code for Python
- Download VS Code from https://code.visualstudio.com and install it.
- Open VS Code and go to the Extensions tab.
- Search for and install the extension: "Python" by Microsoft.
- Install also: "Pylance" (optional, but great for auto-complete).
Select Your Python Interpreter
VS Code needs to know which Python to use.
Press Ctrl + Shift + P
Type: Python: Select Interpreter
Choose Python 3.xOption 2: Set Up PyCharm
PyCharm is a full IDE built just for Python. It configures most things for you automatically.
- Download PyCharm Community Edition from https://www.jetbrains.com/pycharm/.
- Install and open it.
- Click "New Project" → choose a folder.
- PyCharm automatically detects Python and sets everything up!
Using the Terminal
You'll use a terminal to run Python code. Here’s how to access it:
- **Windows**: Open PowerShell or Command Prompt
- **macOS**: Open Terminal from Applications → Utilities
- **Linux**: Open your system terminal (Ctrl + Alt + T)
python --version
# or
python3 --versionIf this shows a version number, your terminal is ready for Python.
Create Your First Workspace
- Create a folder called python-lessons on your Desktop.
- Open that folder in VS Code or PyCharm.
- Inside it, create a file called app.py.
- Write this code:
print("Your Python environment is ready! 🚀")Run it:
python app.py
# or
python3 app.pyMini Project Step
Inside app.py, write a small Python script that prints today’s date using your name. For example:
print("Hi, I'm Chrise and I'm writing Python on my own computer!")