Python Install


🛠️ Python Installation

🔍 Step 1: Check If Python Is Already Installed

Before installing Python, check whether it is already installed on your system.

✅ Windows

Open Command Prompt and type:

python --version

If installed, you will see something like:

Python 3.11.2

If not installed, it may show an error like 'python' is not recognized as an internal or external command.

✅ macOS / Linux

Open the Terminal and type the same command:

python3 --version

If Python 3 is installed, it will show the version.


🧰 Step 2: Download Python

Visit the official Python download page:

👉 https://www.python.org/downloads/

  • The site will automatically detect your operating system.

  • Click the Download Python 3.x.x button.


💾 Step 3: Install Python on Windows

  1. Run the downloaded .exe file.

  2. IMPORTANT: ✅ Check the box that says "Add Python to PATH" (This allows you to use Python from any folder).

  3. Click "Install Now".

  4. Wait for the setup to complete.

  5. Click "Close" once done.

To verify, open Command Prompt and run:

python --version

🍎 Step 3: Install Python on macOS

  1. Download the .pkg installer from the official website.

  2. Open it and follow the default installation steps.

  3. After installation, open Terminal and type:

python3 --version

If you see a version like Python 3.12.0, it’s installed correctly.


🐧 Step 3: Install Python on Linux

Most Linux distributions come with Python pre-installed. But to install the latest version:

sudo apt update
sudo apt install python3

Check the installation:

python3 --version

⚙️ Step 4: Verify Python and pip Installation

After installing Python, you also get pip (Python’s package manager).

Check Python:

python --version  # or python3 --version

Check pip:

pip --version     # or pip3 --version

Output should be like:

pip 23.0.1 from ... (python 3.11)

🧪 Step 5: Write Your First Python Program

Now let's test Python by writing a simple program.

🖥️ Using Command Line:

python

Then type:

print("Hello, Python!")

Output:

Hello, Python!

To exit, type:

exit()

📝 Using a File:

Create a file named hello.py with the following code:

print("Hello from a Python file!")

Run it:

python hello.py

🆘 Troubleshooting Tips

  • If python doesn’t work, try python3.

  • Make sure “Add Python to PATH” was checked during Windows installation.

  • Use where python (Windows) or which python3 (macOS/Linux) to locate Python.


✅ Summary

Platform Command to Run Python Check Version
Windows python python --version
macOS python3 python3 --version
Linux python3 python3 --version

Practice Questions

Q1. Print your name:

Expected: My name is CodePractice 

Q2. Add two numbers and display:

Output: Sum: 15 

Q3. Display installation success message:

Output: Python installed successfully! 

Q4. Show today’s date using datetime:

Output: Today’s date is: YYYY‑MM‑DD 

Q5. Print three lines:

Welcome to Python # Let's start coding # Happy Learning! 


Python Install Quiz

Q1: Python file extension:

A. .pyth
B. .pt
C. .python
D. .py

Q2: Which command is used to check the Python version installed?

A. python -v
B. python --version
C. version python
D. python /v

Q3: What will be the output of the statement print("Hello")?

A. Hello
B. "Hello"
C. print Hello
D. None of the above

Q4: What is the official website to download Python?

A. installpython.com
B. python-downloads.org
C. pypi.org
D. python.org

Q5: Which tool is commonly used to write Python code?

A. Notepad
B. MS Word
C. Python IDE or text editor
D. Chrome

Go Back Top