Below is a complete, step-by-step, beginner-friendly explanation of Getting and Installing Python, suitable for BCA/MCA, B.Tech, and university exams.
Getting and Installing Python
Python is free, open-source, and available for all major operating systems like Windows, macOS, and Linux. Installing Python ensures you can write, run, and test Python programs on your computer.
1. Downloading Python
To install Python, you need to download the official installer from the Python website.
Official Website
Steps:
- Open your web browser.
- Go to python.org.
- Click on the Downloads tab.
- The website automatically detects your operating system (Windows, Mac, etc.).
- Click the Download Python 3.x.x button (latest stable version).
2. Installing Python on Windows
Step-by-Step Installation:
Step 1: Run Installer
- Double-click the downloaded file (example:
python-3.12.0.exe).
Step 2: IMPORTANT — Check the box
☑ Add Python to PATH
(This makes Python accessible from command prompt.)
Step 3: Choose Installation Type
- Click Install Now for default installation
OR - Click Customize installation if you want advanced options.
Step 4: Installation Begins
- Wait for it to complete.
Step 5: Verify Installation
Open Command Prompt and type:
python --version
or
python
If Python is installed correctly, it will display the version.
3. Installing Python on macOS
Steps:
- Download the macOS installer (
.pkgfile) from python.org. - Double-click it.
- Follow the on-screen installation wizard.
- After installation, open Terminal.
- Verify Python using:
python3 --version
Note: macOS uses python3 command instead of python.
4. Installing Python on Linux (Ubuntu/Debian)
Most Linux distributions come with Python preinstalled.
To check version:
python3 --version
To install/update Python manually:
sudo apt update
sudo apt install python3
To install pip (package installer):
sudo apt install python3-pip
5. Installing pip (Python Package Manager)
pip is used to install external Python libraries like pandas, numpy, flask, etc.
To check if pip is installed:
pip --version
If not installed:
python -m ensurepip --default-pip
Or manual installation:
python get-pip.py
6. Installing an IDE or Code Editor
Although Python can be written in any editor, using an IDE makes coding easier.
Popular IDEs for Python:
- PyCharm (most powerful)
- VS Code (lightweight, highly recommended)
- Jupyter Notebook (for data science)
- IDLE (comes with Python installation)
Installing VS Code:
- Go to https://code.visualstudio.com
- Download for your OS
- Install & add the Python extension from the Extensions tab
7. Running Your First Python Program
Method 1: Using Command Line
Create a file:
hello.py
Add:
print("Hello, Python!")
Run:
python hello.py
Method 2: Using IDLE
- Open IDLE (comes with Python).
- Type:
print("Hello") - Press Enter.
Method 3: Using VS Code
- Create a new
.pyfile. - Write your code.
- Click Run or press
Ctrl+F5.
8. Virtual Environments (Optional but Important)
Virtual environments allow you to create separate spaces for different projects.
Create virtual environment:
python -m venv myenv
Activate:
- Windows:
myenv\Scripts\activate - macOS/Linux:
source myenv/bin/activate
Deactivate:
deactivate
9. Updating Python
You can always update Python by downloading a newer version from python.org and installing it.
Upgrading will NOT delete your previous programs.
10. Summary
| Step | Description |
|---|---|
| Download | From python.org |
| Install | Run installer, check “Add to PATH” |
| Verify | Use python --version |
| Install pip | For package management |
| Install IDE | (VS Code, PyCharm, IDLE) |
| Run code | Use terminal, IDLE, or IDE |
