Getting Started
Installing Python
Learn how to install Python on different operating systems and run your first simple Python program from the command line.
Installing Python
To begin writing Python code, you’ll need to install the Python interpreter.
Windows
Visit python.org/downloads
Download the latest version for Windows.
Run the installer and check the box that says
Add Python to PATH
.Click “Install Now.”
macOS
Use Homebrew:
bashCopyEditbrew install python
Or download the installer from python.org.
Linux
Use your system’s package manager:
bashCopyEditsudo apt install python3 # Debian/Ubuntu sudo dnf install python3 # Fedora
Verifying the Installation
Open a terminal or command prompt and run:
bashCopyEditpython --version # or python3 --version
You should see the installed Python version.
Running Your First Script
Open a text editor and write this code:
pythonCopyEditprint("Hello, world!")
Save the file as
hello.py
.Run the file from the terminal:
bashCopyEditpython hello.py # or python3 hello.py
You should see:
CopyEditHello, world
Congratulations! You've run your first Python program.
Installing Python
To begin writing Python code, you’ll need to install the Python interpreter.
Windows
Visit python.org/downloads
Download the latest version for Windows.
Run the installer and check the box that says
Add Python to PATH
.Click “Install Now.”
macOS
Use Homebrew:
bashCopyEditbrew install python
Or download the installer from python.org.
Linux
Use your system’s package manager:
bashCopyEditsudo apt install python3 # Debian/Ubuntu sudo dnf install python3 # Fedora
Verifying the Installation
Open a terminal or command prompt and run:
bashCopyEditpython --version # or python3 --version
You should see the installed Python version.
Running Your First Script
Open a text editor and write this code:
pythonCopyEditprint("Hello, world!")
Save the file as
hello.py
.Run the file from the terminal:
bashCopyEditpython hello.py # or python3 hello.py
You should see:
CopyEditHello, world
Congratulations! You've run your first Python program.
Installing Python
To begin writing Python code, you’ll need to install the Python interpreter.
Windows
Visit python.org/downloads
Download the latest version for Windows.
Run the installer and check the box that says
Add Python to PATH
.Click “Install Now.”
macOS
Use Homebrew:
bashCopyEditbrew install python
Or download the installer from python.org.
Linux
Use your system’s package manager:
bashCopyEditsudo apt install python3 # Debian/Ubuntu sudo dnf install python3 # Fedora
Verifying the Installation
Open a terminal or command prompt and run:
bashCopyEditpython --version # or python3 --version
You should see the installed Python version.
Running Your First Script
Open a text editor and write this code:
pythonCopyEditprint("Hello, world!")
Save the file as
hello.py
.Run the file from the terminal:
bashCopyEditpython hello.py # or python3 hello.py
You should see:
CopyEditHello, world
Congratulations! You've run your first Python program.