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
Setting Up a Productive Python Environment
A working Python is step one; a productive setup means an editor with real tooling and isolated project dependencies. Get this right early and everything after is smoother.
| Piece | Recommendation | Why |
|---|---|---|
| Editor | VS Code + Python extension | autocomplete, linting, debugger |
| Isolation | python -m venv .venv | per-project dependencies |
| Linter/formatter | ruff / black | catch errors, consistent style |
python -m venv .venv # create isolated environment
source .venv/bin/activate # activate (Windows: .venv\Scripts\activate)
pip install ruff # tools install into THIS project only
The habit that saves you: one virtual environment per project, always. Installing packages globally means Project A's dependencies collide with Project B's — and eventually your system Python is a tangled mess. With a venv, each project has its own clean package set recorded in requirements.txt. Add .venv/ to .gitignore so you commit the dependency list, not the heavy installed files. A linter running in your editor turns many runtime errors into red squiggles you fix before running.
🏋️ Practical Exercise
Set up your environment end to end:
- Install an editor (VS Code recommended) and the Python extension.
- Confirm Python is on your PATH by running
python --versionin a terminal. - Create a project folder and a virtual environment with
python -m venv .venv. - Activate it, then run a one-line
print("Setup works!")script from the terminal.
🔥 Challenge Exercise
Create a small project skeleton: a folder containing a .venv virtual environment, a requirements.txt listing one package (e.g. requests), and a main.py. Activate the environment, install from requirements.txt, import the package in main.py to prove it works, then deactivate the environment and confirm the import now fails — demonstrating isolation.
📋 Summary
- VS Code is a lightweight, free editor and the recommended starting point; PyCharm is a full IDE for larger projects.
- Jupyter Notebook suits data science with its cell-based, interactive workflow.
- Verify your install with
python --versionand run scripts withpython file.py. - Virtual environments isolate each project’s dependencies so versions don’t clash.
- Create one with
python -m venv .venvand activate it before installing packages. - Record dependencies in
requirements.txtso others can reproduce your environment.
Interview Questions on Python Setup
- What is the difference between an editor and an IDE for Python?
- How do you check which Python version is installed?
- What is a virtual environment and why is it important?
- How do you create and activate a virtual environment?
- What is the purpose of a
requirements.txtfile? - Why is Jupyter Notebook popular for data science?
- How do you run a Python file from the terminal?
Related Topics
FAQ
VS Code is the most common recommendation: it is free, fast, cross-platform, and its Python extension adds linting, debugging, and IntelliSense. You can graduate to PyCharm later if you want a heavier, Python-focused IDE.
For a throwaway one-file script, no. But as soon as a project installs third-party packages, a virtual environment prevents version conflicts between projects and keeps your global Python clean. It is a good habit to start early.
python sometimes run Python 2? +On some systems python points to an old Python 2. Use python3 explicitly, or check with python --version. On Windows the py launcher lets you select a version with py -3.
It adjusts your shell’s PATH so python and pip point to the environment’s copies instead of the global ones. That way installs and imports stay scoped to that project until you run deactivate.

