Python Installation
Setting up Python correctly is the foundation of everything you'll build. This guide walks you through installing Python on Windows, Mac, and Linux, plus setting up VS Code — the best free code editor for Python developers.
Step 1: Download Python
Go to the official Python website and download the latest Python 3.x installer for your operating system:
- Windows: Download the "Windows installer (64-bit)" (.exe file).
- Mac: Download the "macOS 64-bit universal2 installer" (.pkg file).
- Linux: Python usually comes pre-installed. Check with
python3 --version.
Step 2: Install Python on Windows
- Run the downloaded
.exefile. - IMPORTANT: Check
Add Python to PATHat the bottom of the installer. - Click Install Now.
- Wait for installation to complete, then click Close.
If you forget to check "Add Python to PATH", the python command won't work in the terminal. You'll need to reinstall — easiest fix.
Step 3: Verify Installation
Open Command Prompt (Windows) or Terminal (Mac/Linux) and run:
python --version
# or
python3 --version
You should see something like Python 3.12.0. If yes, you're ready to code!
Step 4: Install VS Code
VS Code is the most popular free code editor. Download from the official website and install it. Then:
- Open VS Code.
- Go to Extensions (
Ctrl+Shift+X). - Search and install Python by Microsoft.
- Optionally install Pylance for better IntelliSense.
Step 5: Run Your First Script
Create a new file hello.py and write:
print("Hello from Varanasi!")
print("Python is running perfectly.")
# Try a calculation
print(2 + 3)
Save and run with Ctrl+F5 or type in terminal: python hello.py
Step 6: Install Packages with pip
pip comes pre-installed with Python 3.4+. To install any package:
pip install numpy
pip install pandas
pip install django
Recommended VS Code Settings
- Font: JetBrains Mono or Fira Code (free, ligature support).
- Theme: One Dark Pro or Dracula.
- Auto-save: Enable (File → Auto Save).
- Format on save: Enable with Black formatter.
Quick Revision
- Download Python 3.x from python.org.
- Always check "Add Python to PATH" on Windows.
- Verify with
python --version. - Install VS Code + Python extension.
- pip comes with Python — use
pip installfor packages.
Interview Questions
Q: What is pip and why is it important?
A: pip is Python's package installer. It allows you to install, update, and manage third-party libraries from PyPI (Python Package Index) with a simple command: pip install package_name.
Q: Difference between a virtual environment and global installation?
A: Global installation installs packages system-wide. Virtual environments (venv) isolate packages per-project — critical for avoiding version conflicts. Always use a virtual environment in real projects.
Want to Master Python?
Join our Python course in Varanasi — practical classes and career support at our Sarnath centre.