Python is one of the most popular programming languages in the world. It is widely used for web development, automation, data science, artificial intelligence, machine learning, scripting, cybersecurity, and software development.
If you are new to Python, one of the first things you need to learn is how to install it correctly on your computer.
The installation process is different depending on whether you are using Windows, macOS, or Linux. You also need to understand the difference between Python, pip, virtual environments, and system Python installations.
This guide explains how to install Python on Windows, macOS, and Linux, how to verify the installation, how to install packages, how to create a virtual environment, and how to fix common installation problems.
What Is Python?
Python is a high-level, general-purpose programming language known for its simple syntax and large ecosystem of libraries and frameworks.
Python can be used for:
- Web development
- Artificial intelligence
- Machine learning
- Data science
- Automation
- Web scraping
- Desktop applications
- Scientific computing
- Cybersecurity
- Backend development
- DevOps
- Testing
- Scripting
One of Python’s biggest advantages is that beginners can start writing useful programs without learning a large amount of complex syntax first.
For example:
print("Hello, World!")
That’s enough to create your first Python program.
Official Python Website
Visit the official Python website
The official website provides Python downloads, documentation, tutorials, package information, and other resources.
What Do You Need to Install Python?
Before installing Python, it is useful to understand the basic components.
Python Interpreter
The Python interpreter executes your Python code.
For example:
python --version
or:
python3 --version
pip
pip is Python’s package installer.
It allows you to install third-party Python packages.
For example:
pip install requests
Python Virtual Environment
A virtual environment creates an isolated Python environment for a project.
For example:
python -m venv myenv
Virtual environments are strongly recommended when working on real Python projects because different projects may require different package versions.
Which Python Version Should You Install?
Python has multiple versions, so beginners often wonder which one they should choose.
The best approach is to install a currently supported Python 3 release from the official Python website.
Avoid Python 2 for new projects. Python 2 reached the end of its official support years ago.
You should also avoid downloading Python from unofficial websites.
Recommended source
Download Python from python.org
If you are installing Python for an existing project, check that project’s documentation first because it may require a specific Python version.
How to Check Whether Python Is Already Installed
Before installing Python, you can check whether it is already available on your computer.
Open your terminal or command prompt.
Try:
python --version
You may see something like:
Python 3.x.x
On many macOS and Linux systems, you may need:
python3 --version
You can also check the location of Python.
Windows
where python
macOS/Linux
which python3
If Python is already installed, you may not need to install it again.
How to Install Python on Windows
Installing Python on Windows is straightforward, especially if you download the installer from the official Python website.
Step 1: Download Python
Open:
Download the current Python 3 installer suitable for your system.
For most modern Windows computers, the standard 64-bit installer is appropriate.
Step 2: Run the Python Installer
Open the downloaded installer.
You will see an installation window.
One of the most important options on this screen is:
Add python.exe to PATH
Make sure this option is selected before clicking the installation button.
This allows you to run Python commands directly from Command Prompt or PowerShell.
For beginners, this is one of the most important steps in the entire installation process.
Step 3: Install Python
Click:
Install Now
The installer will install Python and the associated tools.
Wait for the installation to complete.
Once the installation finishes, you should see a successful installation message.
Step 4: Verify Python on Windows
Open Command Prompt or PowerShell.
Run:
python --version
You should see a Python 3 version.
For example:
Python 3.x.x
You can also try:
py --version
Windows Python installations commonly provide the py launcher.
Step 5: Check pip on Windows
Run:
python -m pip --version
You should see information about the installed pip version and its location.
Using:
python -m pip
is often more reliable than simply typing pip, especially when multiple Python installations exist.
Install Python Using Microsoft Store
Windows may also provide Python through the Microsoft Store.
However, for development work, many developers prefer installing Python directly from python.org because it provides more direct control over the Python installation and environment.
If you are following a development tutorial or project documentation, check which installation method the project recommends.
How to Install Python on macOS
Modern macOS systems can have Python-related components already present, but you should not assume that the Python executable available on your Mac is the version you want for development.
For a development environment, it is usually better to install a current Python 3 release.
Step 1: Download Python for macOS
Open the official Python download page:
Download the appropriate Python 3 installer.
Python provides installers for supported macOS configurations.
Step 2: Install Python
Open the downloaded installer package.
Follow the installation instructions.
The installer will install Python and its associated tools.
Step 3: Open Terminal
After installation, open Terminal.
Run:
python3 --version
You should see the installed Python version.
For example:
Python 3.x.x
Step 4: Verify pip
Run:
python3 -m pip --version
This confirms that pip is available for the Python installation.
Python on Apple Silicon Macs
If you have a newer Mac with an Apple Silicon processor, such as an M-series chip, pay attention to the architecture of the Python installer you download.
Modern Python releases provide installers suitable for current Mac hardware.
If you are using an older Intel-based Mac, make sure you download the appropriate installer.
You can check your Mac architecture using:
uname -m
For example, an Apple Silicon Mac commonly returns:
arm64
An Intel Mac commonly returns:
x86_64
Installing Python on macOS with Homebrew
Developers who already use Homebrew can also install Python through Homebrew.
First, check whether Homebrew is installed:
brew --version
If it is installed, you can install Python with:
brew install python
Then verify:
python3 --version
Homebrew is particularly useful if you manage several development tools from the terminal.
Official Homebrew Website
How to Install Python on Linux
Python is commonly available on Linux distributions, but the exact installation process depends on the distribution.
Popular Linux distributions include:
- Ubuntu
- Debian
- Fedora
- Linux Mint
- Arch Linux
- openSUSE
Many Linux distributions already include Python 3 because system tools may depend on it.
However, the system Python installation should generally not be modified unnecessarily.
For development, you may want to install a separate supported Python version or use a version-management tool.
How to Install Python on Ubuntu
Ubuntu is one of the most commonly used Linux distributions for Python development.
First, update the package information:
sudo apt update
Then install Python 3:
sudo apt install python3
Verify the installation:
python3 --version
You should see the installed Python 3 version.
Install pip on Ubuntu
Depending on the Ubuntu version and packages already installed, pip may not be available by default.
You can install it with:
sudo apt install python3-pip
Then check:
python3 -m pip --version
Install Virtual Environment Support on Ubuntu
For project development, install the virtual environment package if needed:
sudo apt install python3-venv
You can then create a virtual environment:
python3 -m venv myenv
Activate it:
source myenv/bin/activate
When activated, your terminal will normally show the environment name.
Installing Python on Fedora
Fedora uses the dnf package manager.
You can install Python using:
sudo dnf install python3
Then verify:
python3 --version
You can check pip with:
python3 -m pip --version
Always check Fedora’s current documentation when installing a specific Python version because package names and supported versions can change over time.
Installing Python on Arch Linux
Arch Linux users can install Python through the system package manager:
sudo pacman -S python
Then verify:
python --version
Arch Linux generally provides current packages, so the available Python version can change as the distribution is updated.
How to Verify the Python Installation
Once Python is installed, the next step is verifying that everything works correctly.
Run:
Windows
python --version
macOS/Linux
python3 --version
Then check pip.
Windows
python -m pip --version
macOS/Linux
python3 -m pip --version
If both commands return version information, your basic Python installation is working.
Run Python in Interactive Mode
Python also provides an interactive interpreter.
On Windows:
python
On macOS/Linux:
python3
You should see a Python prompt similar to:
>>>
Now type:
print("Python is working!")
You should get:
Python is working!
To exit the Python interpreter, you can use:
exit()
Create Your First Python Program
Now let’s create an actual Python file.
Create a file named:
hello.py
Add:
print("Hello, World!")
Save the file.
Open a terminal in the same directory.
On Windows:
python hello.py
On macOS/Linux:
python3 hello.py
You should see:
Hello, World!
Congratulations! You have successfully executed your first Python program.
How to Install Python Packages with pip
One of Python’s biggest advantages is its massive package ecosystem.
You can install packages using pip.
For example:
python -m pip install requests
On macOS/Linux, you may use:
python3 -m pip install requests
The requests package allows Python programs to make HTTP requests.
You can find Python packages on PyPI, the Python Package Index.
Official PyPI Website
How to Upgrade pip
You can upgrade pip using:
Windows
python -m pip install --upgrade pip
macOS/Linux
python3 -m pip install --upgrade pip
It is usually better to use python -m pip or python3 -m pip because it ensures that pip is associated with the Python interpreter you intend to use.
What Is a Python Virtual Environment?
A virtual environment creates an isolated environment for a Python project.
Imagine you have two projects:
Project A
Requires:
requests 2.x
Project B
Requires a different package version.
Installing everything globally can create dependency conflicts.
A virtual environment helps keep each project’s dependencies separate.
Create a Python Virtual Environment
First create a project folder:
mkdir my-python-project
Move into it:
cd my-python-project
Create a virtual environment.
Windows
python -m venv .venv
macOS/Linux
python3 -m venv .venv
This creates a .venv directory.
Activate the Virtual Environment
Windows Command Prompt
.venv\Scripts\activate
Windows PowerShell
.venv\Scripts\Activate.ps1
macOS/Linux
source .venv/bin/activate
Once activated, package installations will normally be associated with this project’s environment.
Install a Package Inside the Virtual Environment
After activation, run:
python -m pip install requests
You can check installed packages with:
python -m pip list
Deactivate a Virtual Environment
When you finish working on the project, run:
deactivate
The virtual environment remains on your computer, but the terminal will return to the normal Python environment.
Python Installation vs Python Development Setup
Installing Python is only the first step.
A complete Python development environment may include:
- Python
- pip
- Virtual environments
- Code editor
- Git
- Project dependencies
- Testing tools
- Linters
- Formatters
For beginners, you don’t need to install everything immediately.
A simple setup is enough:
Python + VS Code + pip + virtual environments
Install Visual Studio Code for Python
Visual Studio Code is a popular code editor for Python development.
Download it from the official website:
After installation, open VS Code and install the official Python extension from Microsoft.
The extension provides features such as:
- Syntax highlighting
- Code completion
- Debugging
- Testing
- Python environment selection
- IntelliSense
- Code navigation
You can then open your Python project folder in VS Code.
Select the Correct Python Interpreter in VS Code
If you create a virtual environment, VS Code needs to know which Python interpreter should be used.
Open the Command Palette and search for:
Python: Select Interpreter
Choose the Python interpreter from your project’s .venv directory.
This is especially important when you have multiple Python versions installed.
How to Check Which Python Executable Is Being Used
Sometimes multiple Python versions exist on the same computer.
You can check the executable location.
Windows
where python
macOS/Linux
which python3
Inside Python, you can also check:
import sys
print(sys.executable)
This prints the exact Python executable being used.
Common Python Installation Problems
Problem 1: python is not recognized
Windows users may see an error similar to:
'python' is not recognized as an internal or external command
This usually means Windows cannot find the Python executable.
Possible solutions
First try:
py --version
If that works, Python may be installed correctly but the python command may not be configured as expected.
You can also reinstall Python and make sure:
Add python.exe to PATH
is selected.
Problem 2: python3: command not found
On macOS or Linux, you may see:
python3: command not found
This generally means Python 3 is not installed or is not available through your current PATH.
Install Python using the appropriate method for your operating system and verify again:
python3 --version
Problem 3: pip Is Not Found
If:
pip
does not work, try:
python -m pip --version
or:
python3 -m pip --version
This is often the preferred approach because it explicitly associates pip with the selected Python interpreter.
Problem 4: Permission Error While Installing Packages
You may encounter an error such as:
Permission denied
when installing a package globally.
Instead of modifying your system Python installation, create a virtual environment:
python3 -m venv .venv
Activate it:
source .venv/bin/activate
Then install packages inside the environment:
python -m pip install package-name
This is generally a cleaner approach for project development.
Problem 5: Multiple Python Versions
It is possible to have multiple Python versions installed.
For example:
Python 3.10
Python 3.11
Python 3.12
Python 3.13
This is not automatically a problem.
However, you need to know which interpreter your project is using.
Check:
python --version
or:
python3 --version
You can also use:
import sys
print(sys.version)
For larger projects, tools such as pyenv can help manage multiple Python versions.
Problem 6: Do Not Delete System Python on Linux
This is especially important for Linux users.
Some Linux system utilities may depend on the system’s Python installation.
Therefore, do not randomly uninstall or replace the system Python version just because you want to use a newer Python version for development.
Instead, use:
- Virtual environments
- Distribution-supported packages
- Python version managers
- Containers
- Project-specific environments
This helps prevent system-level problems.
Python Installation Best Practices
Once Python is installed, follow a few simple practices.
1. Use Python 3
For new development, use a currently supported Python 3 release.
2. Use Virtual Environments
Create a virtual environment for individual projects.
3. Keep Dependencies Isolated
Avoid installing every project dependency globally.
4. Use Official Sources
Download Python from:
and use trusted package repositories such as:
5. Keep Python Updated
Use supported Python releases and update your development environment when appropriate.
6. Use a Dependency File
For many Python projects, dependencies can be recorded in:
requirements.txt
For example:
requests
flask
numpy
Then install them with:
python -m pip install -r requirements.txt
What Can You Build After Installing Python?
Once Python is installed, you can explore many areas of software development.
Web Development
Popular Python frameworks include:
- Django
- Flask
- FastAPI
Artificial Intelligence
Python is one of the primary languages used for:
- Machine learning
- Deep learning
- Generative AI
- Natural language processing
- Computer vision
Data Science
Python has a huge ecosystem for:
- Data analysis
- Visualization
- Statistics
- Scientific computing
Popular libraries include:
- NumPy
- pandas
- Matplotlib
- SciPy
Automation
Python can automate repetitive tasks such as:
- File management
- Data processing
- Report generation
- Web requests
- System administration
Backend Development
Python can be used to create:
- REST APIs
- Authentication systems
- Web services
- Microservices
- Database applications
Useful Python Commands Cheat Sheet
Here are some commands you should remember.
| Purpose | Windows | macOS/Linux |
|---|---|---|
| Check Python | python --version | python3 --version |
| Check pip | python -m pip --version | python3 -m pip --version |
| Start Python | python | python3 |
| Run file | python app.py | python3 app.py |
| Create venv | python -m venv .venv | python3 -m venv .venv |
| Install package | python -m pip install package | python3 -m pip install package |
| List packages | python -m pip list | python3 -m pip list |
Official Python Resources
If you want to provide readers with useful external links, these official resources are excellent additions to this article.
Python Official Website
Use this as the primary link for Python information and downloads.
Python Downloads
Use this link in the installation section.
Python Documentation
Use this when readers need official language documentation.
Python Beginner’s Guide
Useful for readers who are completely new to Python.
Python Package Index
Use this when explaining Python packages and pip.
Visual Studio Code
Use this when recommending an editor for Python development.
Frequently Asked Questions
Is Python free to install?
Yes. Python is open-source software and can be downloaded from the official Python website.
Should beginners install Python 2 or Python 3?
Beginners should use a currently supported Python 3 release. Python 2 is obsolete and should not be used for new projects.
Do I need pip to use Python?
You can run basic Python code without pip, but pip is extremely useful for installing third-party Python packages.
Do I need a virtual environment?
You don’t need one for simple experiments, but virtual environments are strongly recommended for real projects.
Can I install Python on Windows and macOS?
Yes. Python supports Windows, macOS, and Linux.
Can I have multiple Python versions?
Yes. Multiple Python versions can exist on the same computer, although you should manage them carefully so that your projects use the correct interpreter.
Is Python enough for AI development?
Python provides the foundation for many AI and machine-learning workflows, but you will usually also install specialized libraries and frameworks depending on your project.
Final Thoughts
Installing Python is the first step toward building applications, automating tasks, working with data, and exploring artificial intelligence.
The basic process is simple:
Download Python → Install Python → Verify Python → Install pip → Create a virtual environment → Start coding.
For Windows users, remember to enable Add Python to PATH during installation.
For macOS and Linux users, use python3 when that is the command provided by your environment.
After installation, verify everything with:
python --version
or:
python3 --version
Then create your first program:
print("Hello, Python!")
Once your installation is working, the next step is to learn Python fundamentals such as variables, data types, conditions, loops, functions, lists, dictionaries, classes, modules, and exception handling.
From there, you can move into advanced areas such as Django, FastAPI, data science, machine learning, AI, automation, and backend development.
The most important thing for beginners is to keep the setup simple. Install a supported Python 3 version, use virtual environments for projects, and practice by building small programs regularly.




