Last modified: Sep 27, 2026
How to Install Python 3.9
Python 3.9 is a popular version of the Python language. It is stable, fast, and widely used.
Many beginners want to install it correctly the first time. This guide walks you through every step.
You will learn how to install Python 3.9 on Windows, macOS, and Linux. You will also learn how to check your setup.
Why Choose Python 3.9
Python 3.9 was released in October 2020. It added useful features to the language.
It includes better dictionary merging and improved type hints. These features help you write cleaner code.
Python 3.9 is also a good choice for older systems. Some libraries still support it well.
If you are learning Python, version 3.9 is a safe and reliable option.
Check If Python Is Already Installed
Before you install anything, check your current setup. Open your terminal or command prompt.
Run the following command to see if Python is present.
python --version
If you see a version number, Python is installed. If not, you will get an error message.
On some systems, you may need to use python3 instead.
python3 --version
If the output shows Python 3.9 or higher, you are ready to go. If not, continue with the steps below.
How to Install Python 3.9 on Windows
Windows users can install Python 3.9 easily with the official installer.
First, go to the official Python website. Find the Python 3.9 download page.
Download the Windows installer for your system. Choose the 64-bit version if your PC is 64-bit.
Run the installer file. A setup window will open.
Important: Check the box that says "Add Python 3.9 to PATH". This step is very important.
Click "Install Now" and wait for the process to finish. It usually takes a few minutes.
When it is done, open the Command Prompt. Type the version command again.
python --version
You should see a message like this.
Python 3.9.13
If you see this, your installation worked. You can now run Python code.
How to Install Python 3.9 on macOS
macOS comes with a system version of Python. But it is often old.
You should install Python 3.9 separately. The easiest way is with Homebrew.
Open the Terminal app. First, install Homebrew if you do not have it.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After Homebrew is ready, install Python 3.9 with one command.
brew install [email protected]
Homebrew will download and install Python 3.9 for you. This may take a few minutes.
When it finishes, check the version. You may need to use the full name.
python3.9 --version
The output should show Python 3.9. You can also use the brew list command to confirm the install.
brew list | grep python
This will show all Python packages installed by Homebrew.
How to Install Python 3.9 on Linux
Linux users can install Python 3.9 with their package manager. The steps depend on your distribution.
On Ubuntu and Debian, update your package list first.
sudo apt update
Then install Python 3.9 and its tools.
sudo apt install python3.9 python3.9-venv python3.9-dev
On Fedora, use the dnf command instead.
sudo dnf install python3.9
On Arch Linux, Python is usually up to date. You can install it with pacman.
sudo pacman -S python
After installation, check the version to confirm everything is fine.
python3.9 --version
If you see Python 3.9, you are all set on Linux.
Verify Your Installation
After installing Python 3.9, you should test it. Open your terminal or command prompt.
Run the version command one more time. Make sure it shows 3.9.
Next, open the Python interactive shell. Type python3.9 and press Enter.
python3.9
You will see a prompt with three arrows. Now you can run Python code directly.
Try a simple print statement to test it.
# Print a greeting message
print("Hello, Python 3.9!")
The output will appear right away.
Hello, Python 3.9!
Type exit() to leave the shell. This confirms your install works.
Set Up a Virtual Environment
A virtual environment keeps your projects separate. This is a best practice in Python.
It stops one project from breaking another. It also keeps your system clean.
Create a new folder for your project. Then move into it.
mkdir myproject
cd myproject
Now create a virtual environment with Python 3.9.
python3.9 -m venv venv
Activate the environment. The command differs by operating system.
On Windows, run this command.
venv\Scripts\activate
On macOS and Linux, run this command instead.
source venv/bin/activate
Your prompt will change to show the environment name. Now you can install packages safely.
Install Packages with pip
Python 3.9 comes with pip, the package manager. You can use it to add libraries.
Make sure your virtual environment is active first. Then run the install command.
pip install requests
This will download and install the requests library. You can check it with the pip list command.
pip list
You will see all installed packages in your environment.
Common Installation Problems
Sometimes things do not go as planned. Here are some common issues and fixes.
If the python command is not found, the PATH is likely wrong. Reinstall and check the PATH box on Windows.
On macOS and Linux, try using python3.9 instead of python.
If pip is missing, install it with the ensurepip module.
python3.9 -m ensurepip --upgrade
If you get permission errors, avoid using sudo with pip. Use a virtual environment instead.
These small fixes solve most problems quickly.
Conclusion
Installing Python 3.9 is a simple task when you follow the right steps.
On Windows, use the official installer and check the PATH box. On macOS, use Homebrew. On Linux, use your package manager.
Always verify your install with the version command. Then set up a virtual environment for your projects.
With Python 3.9 ready, you can start coding right away. Happy coding!