VS Code β The Recommended Choice
Visual Studio Code is the most popular Python editor worldwide. It is free, fast, open source, and has an excellent Python extension maintained by Microsoft. Features: syntax highlighting, IntelliSense autocomplete, integrated terminal, debugger, Jupyter support, Git integration.
# After installing VS Code and the Python extension:
# 1. Open a folder: File β Open Folder
# 2. Create a new file: hello.py
# 3. Type your code:
print("Hello from VS Code!")
# 4. Press Ctrl+F5 to run (no debug)
# 5. Output appears in the integrated terminal
PyCharm β Best for Professional Python
PyCharm Community Edition is a free, full-featured Python IDE. Better refactoring tools, more intelligent autocomplete, and built-in virtual environment management compared to VS Code. Heavier on memory (~400MB). Ideal if you plan to work on large Python projects exclusively.
PyCharm Professional (paid) adds Django support, database tools, and scientific mode. The Community edition is sufficient for most learners.
Jupyter Notebook β Best for Data Science
Jupyter Notebook lets you mix code, output, and text in a single document. Ideal for data analysis and machine learning experiments. Install with: pip install jupyter. Launch with: jupyter notebook in your terminal.
# Install and launch Jupyter
# In terminal:
# pip install jupyter
# jupyter notebook
# Each "cell" runs independently:
x = 10
y = 20
print(x + y) # Shows output directly below the cell
Running Python from Terminal
No matter which editor you use, knowing how to run Python from the terminal is essential. Create a .py file, then run it from the directory containing the file.
# Create file: my_script.py
name = input("Enter your name: ")
print(f"Hello, {name}!")
# Run from terminal:
# python my_script.py (Windows)
# python3 my_script.py (macOS/Linux)
Virtual Environments β Why and How
Virtual environments isolate project dependencies so different projects don't conflict. Always create one before installing packages for a real project.
# Create a virtual environment
python -m venv myenv
# Activate it:
# Windows: myenv\Scripts\activate
# macOS/Linux: source myenv/bin/activate
# Install packages (only affects this env)
pip install requests pandas
# Deactivate when done
# deactivate