How to Install and Run Python Program for Beginners
1. Install Python
For Windows:
1. Go to the official website: https://www.python.org/downloads
2. Click "Download Python 3.x.x.(download latest)
3. Run the downloaded .exe file.
4. Make sure to check the box: "Add Python to PATH".
5. Click "Install Now".
For macOS:
- You can use the same website to download and install Python.
- Alternatively, install using Homebrew:
brew install python
For Linux:
Use your package manager:
sudo apt update
sudo apt install python3
2. Check Python Installation
Open Command Prompt (Windows) or Terminal (Mac/Linux) and type:
python --version
or
python3 --version
You should see something like:
Python 3.12.0
3. Write Your First Python Program
You can write Python code in any text editor (Notepad, VS Code, etc.).
Example: Hello World Program
Create a new file named hello.py and write:
print("Hello, world!")
4. Run Your Python Program
Method 1: Using Command Line
1. Open Terminal or Command Prompt.
2. Navigate to the folder where hello.py is saved using cd command:
cd path\to\your\file
3. Run:
python hello.py
or
python3 hello.py
You will see:
Hello, world!
5. Optional: Install a Code Editor (Recommended)
Install VS Code: https://code.visualstudio.com/
- Install the Python extension (search "Python" in Extensions).
- Open your .py file and click "Run".
Summary
Step Action
1 Install Python from python.org
2 Confirm with `python --version`
3 Create a .py file
4 Write `print("Hello, world!")`
5 Run with `python filename.py`