Installation by Operating System
Getting Python running is the first real step. The process varies by OS, but the goal is the same: a working python3 command in your terminal.
Windows
- Go to python.org/downloads and download the latest Python 3.x installer.
- Run the installer. Critical: check "Add Python to PATH" before clicking Install Now. Without this, you'll get "python is not recognized" errors forever.
- Open Command Prompt or PowerShell and verify:
python --version
# Python 3.12.x
pip --version
# pip 24.xOn Windows, the command might be python instead of python3. If python3 fails, try python. If neither works, Python isn't in your PATH โ reinstall and check that box.
macOS
macOS ships with Python 2 for legacy scripts. You need Python 3:
# Option 1: Official installer from python.org (easiest for beginners)
# Download .pkg from https://python.org/downloads/mac-osx/
# Option 2: Homebrew (recommended for developers)
brew install python3
# Verify
python3 --version
pip3 --versionLinux
# Check if Python 3 is already installed
python3 --version
# Ubuntu/Debian โ install if needed
sudo apt update && sudo apt install python3 python3-pip
# Fedora/RHEL
sudo dnf install python3 python3-pip
# Arch
sudo pacman -S python python-pipChoosing an Editor
You can write Python in any text editor, but a proper IDE makes development far faster. Here are your options:
| Editor | Best For | Free? |
|---|---|---|
| VS Code | All-around development, most popular by far | โ Free |
| PyCharm | Professional Python, large projects, Django | Community edition free |
| Jupyter Notebook | Data science, interactive exploration | โ Free |
| Vim/Neovim | Terminal power users | โ Free |
| IDLE | Beginners, comes bundled with Python | โ Free |
Recommendation for beginners: VS Code with the Python extension. It gives you syntax highlighting, autocomplete (IntelliSense), debugging, and an integrated terminal โ all for free.
Setting Up VS Code for Python
- Download VS Code from code.visualstudio.com
- Install the Python extension (publisher: ms-python)
- Install Pylance for better type-aware intellisense
- Open a
.pyfile โ VS Code will detect your Python interpreter automatically - Select your interpreter:
Ctrl+Shift+Pโ "Python: Select Interpreter"
Virtual Environments
Every Python project should have its own isolated environment. This prevents package version conflicts between projects. It's professional practice โ start doing this from day one.
# Create a virtual environment in the current directory
python3 -m venv venv
# Activate it
source venv/bin/activate # macOS/Linux
.\venv\Scripts\activate # Windows PowerShell
# Your terminal prompt changes to show (venv)
# Now install packages โ they're isolated to this project
pip install requests
# Deactivate when done
deactivate
# Save your dependencies
pip freeze > requirements.txt
# Reproduce environment elsewhere
pip install -r requirements.txtBefore working on any Python project, activate its virtual environment. Check your prompt โ if you see (venv), you're good. If not, you might be installing packages globally.
Verifying Everything Works
# Check Python version (should be 3.8+)
python3 --version
# Check pip
pip3 --version
# Launch the interactive REPL
python3
# >>> appears โ you're in Python!
>>> 2 + 2
4
>>> print("Hello from Python!")
Hello from Python!
>>> exit() # or Ctrl+D to quitKey Takeaways
- Add to PATH on Windows: check that box during installation
- VS Code + Python extension: best beginner + professional setup
- Virtual environments are mandatory: one per project, activate before working
- python3 not python: avoids accidentally using Python 2
Practice Exercises
- Install Python and confirm
python3 --versionworks in your terminal. - Open the Python REPL and type
2 ** 10. What's the result? - Install VS Code with the Python extension. Create a file
hello.pythat prints your name. - Create a virtual environment called
learning, activate it, install therequestspackage, then deactivate.