C:\users\username\> python -V
The output should be one of the following (*version numbers will vary*). **C:\users\username\> is not typed** - Windows displays this as part of the terminal UI.
#### Success, you have Python
C:\users\username\> python -V
Python 3.12.0
If you see this and the reported version number is sufficiently high (often 3.9 or higher), **you are good to go**.
#### 2.7? Uh oh, your Python is badly outdated!
C:\users\username\> python -V
Python 2.7.18
If you have `Python 2.*`, then you are using an outdated version of Python. [**Since 2020, Python 2 has gone entirely unsupported**](https://stackoverflow.blog/2020/04/23/the-final-python-2-release-marks-the-end-of-an-era/) and should not be used. **You will need to continue below to install Python 3**.
#### Ooops, you do NOT have Python
C:\users\username\> python -V
'python' is not recognized as a command or program.
Looks like you do not have Python at all. **You will need to continue below to install Python 3**. Note that the error message may be slightly different for **Windows Terminal**: *The term python is not recognized as a cmdlet, function, or operable program*.
#### Ooops, you still do NOT have Python
C:\users\username\> python -V
Python was not found; run without arguments to install from the Windows Store...
Looks like you do not have Python at all. **You will need to continue below to install Python 3**. When you see this specific error message, it means that Python is not installed. What is running is a shim program meant to help you install Python 3 from the Windows Store (one option below). You can select this option by simplifying typing `python` and following along in the UI.
### Step 3. You need Python, install it on Windows
So you need to install a new version of Python on your Windows machine. There are a variety of options for doing so. We'll run you through them, but **if you are uncertain which one to get, just use the official installer**. Keep in mind that no matter how you install Python, **you will likely need to close and reopen your terminal/command prompt for any changes to take effect**.
- **Python Official Installer** << recommended
- Windows Store
- Chocolatey Package Manager for Windows
- Anaconda Distribution
#### << **Python Official Installer on Windows** >>
The Python official installer can be found on **[python.org](http://python.org)**.
**Pros**
* It's the primary way the Python Software Foundation delivers Python to users
* The installer is supported by core developers working at Microsoft
**Cons**
* You will not be notified of possible updates
* There is no mechanism to have a new version automatically replace the installed version
**Install steps - Windows official installer**:
1. Visit the **[downloads page for Windows at python.org](https://www.python.org/downloads/windows/)**
2. Find the section entitled **Stable Releases**
3. Download the MSI installer under the **Download Windows installer (64-bit)** link
4. Run the installer - **be sure to check the "add python to my path" option**
5. Close all terminal and command prompt windows
6. Run `python -V` in a new terminal window to verify you have Python now working
#### << **Windows Store version of Python** >>
The Windows Store version of Python is a good option. It's the easiest way to get Python on Windows without administrator permissions. But there are some drawbacks too.
**Pros**
* Easiest way to get Python on Windows **without administrator permissions**
* Will keep Python up-to-date automatically within a release version (3.10 updates but not 3.10->3.11)
* Maintained by the core developers who work at Microsoft
**Cons**
* Does have some minor permission restrictions that apply to all Windows Store apps which can affect your development options
**Install steps - Microsoft Store Python**:
1. Open the Microsoft Store on Windows
2. Search for Python
3. Find the latest version of Python from Microsoft (currently lists 3.7, 3.8, 3.9, 3.10, 3.11, and [**3.12**](https://apps.microsoft.com/detail/python-3-12/9NCVDN91XZQP?hl=en-us&gl=US))
4. Install from the Microsoft Store
5. Close all terminal and command prompt windows
6. Run `python -V` in a new terminal window to verify you have Python now working
#### << **Chocolatey Package Manager for Windows** >>
[Chocolatey](https://chocolatey.org/) is a [package manager](https://en.wikipedia.org/wiki/Package_manager): software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer's operating system in a consistent manner. If you're comfortable using package managers, then this is a good option for you because you can continually update and maintain Python on your system.
**Pros**
* Will keep Python up-to-date on your system as long as you periodically run the upgrade command
* Will update across versions (e.g. 3.11 -> 3.12)
* Can inform you of pending upgrade if upgrade command is run
**Cons**
* Complex to use
* Must run as administrator
* Requires separate install of chocolatey itself
**Install steps - Chocolatey package manager on Windows**
1. Install Chocolatey - [**steps here**](https://docs.chocolatey.org/en-us/choco/setup)
2. Open an **[administrator command prompt](https://www.howtogeek.com/194041/how-to-open-the-command-prompt-as-administrator-in-windows-8.1/)**
3. Install the latest Python: `choco install python`
4. Periodically check for a new release: Open admin command prompt and run `choco upgrade python`
5. Close all terminal and command prompt windows and reopen one (to refresh the path)
6. Run `python -V` in a new terminal window to verify you have Python now working
#### << **Anaconda distribution on Windows** >>
[Anaconda is a distribution of Python](https://www.anaconda.com/products/individual) that packages many of the common data science packages pre-configured for your system. It is a good option for data scientists.
**Pros**
* Many packages and libraries are pre-installed
* Good for data science tooling in Python
**Cons**
* Generally uses [conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) rather than [Python's virtual environments](https://www.geeksforgeeks.org/python-virtual-environment/) - this can lead to a mismatch in instructions when Anaconda is not the primary tool used.
* Packages available here often lag behind in release schedule from PyPI / pip
* Often one whole version behind on Python (e.g. 3.10 rather than 3.11)
**Install steps - Anaconda distribution on Windows**
1. [Download the Windows installer](https://www.anaconda.com/products/individual#)
2. Run the installer, add Python to path if asked
3. Close all terminal and command prompt windows
4. Run `python -V` in a new terminal window to verify you have Python now working
_________________________
## macOS
### Step 2. Do you have Python? Let's check
To determine if you have Python installed, open the [**terminal**](https://www.makeuseof.com/open-terminal-on-mac/). Verify you have Python: In the terminal, type **python3 -V** (capital V):
$ python3 -V
The output should be one of the following (*version numbers will vary*). Do not type **$** - macOS displays this as part of the terminal UI.
#### Success, you have Python
$ python3 -V
Python 3.12.0
If you see this and the reported version number is sufficiently high (often 3.9 or higher), **you are good to go**.
#### 2.7? Uh oh, your Python is badly outdated!
If `python3` **does NOT run successfully**, but `python` (without the 3) itself does and you see the output:
$ python -V
Python 2.7.18
If you have `Python 2.*`, then you are using an outdated version of Python. [**Since 2020, Python 2 has gone entirely unsupported**](https://stackoverflow.blog/2020/04/23/the-final-python-2-release-marks-the-end-of-an-era/) and should not be used. **You will need to continue below to install Python 3**.
#### Ooops, you do NOT have Python
$ python3 -V
bash: python3: command not found
Looks like you do not have Python 3 at all. **You will need to continue below to install Python 3**. Note that the error message is slightly different for different shells.
### Step 3. You need Python, install it on macOS
- **Homebrew** << recommended
- Python Official Installer
- Anaconda distribution
#### << **Homebrew Package Manager for macOS** >>
**[Homebrew](https://brew.sh/)** is a [package manager](https://en.wikipedia.org/wiki/Package_manager): software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer's operating system in a consistent manner. If you're comfortable using package managers, then this is a good option for you because you can continually update and maintain Python on your system.
**Pros**
* Will keep Python up-to-date on your system as long as you periodically run the upgrade command
* Will update across versions (e.g. 3.11 -> 3.12)
* Can inform you of pending upgrade if upgrade command is run
**Cons**
* Complex to use
* Requires separate install of homebrew itself
**Install steps - Homebrew package manager on macOS**
1. Install Homebrew - [**steps here**](https://brew.sh/)
2. Open a **[terminal](https://www.makeuseof.com/open-terminal-on-mac/)**
3. Install the latest Python: `brew install python`
4. Periodically check for a new release: Open terminal and run `brew update` then `brew upgrade`
5. **CAREFUL**: Take careful note of any messages shown - sometimes you must [update your path](https://coolestguidesontheplanet.com/add-shell-path-osx/) (varies by default shell: bash, zsh, etc.) for this version to be located.
5. Close all terminal windows
6. Run `python3 -V` in a new terminal window to verify you have Python now working
#### << **Python Official Installer on macOS** >>
The Python official installer can be found on **[python.org](http://python.org)**.
**Pros**
* It's the primary way the Python Software Foundation delivers Python to users
* The installer is supported by core developers
**Cons**
* You will not be notified of possible updates
* There is no mechanism to have a new version automatically replace the installed version
* Requires admin permissions
**Install steps - macOS official installer**:
1. Visit the **[downloads page for macOS](https://www.python.org/downloads/mac-osx/)**
2. Find the section entitled **Stable Releases**
3. Download the PKG installer under the **Download macOS 64-bit universal2 installer** link
4. Run the installer
5. Close all terminal and command prompt windows
6. Run `python3 -V` in a new terminal window to verify you have Python now working
#### << **Anaconda distribution on macOS** >>
[Anaconda is a distribution of Python](https://www.anaconda.com/products/individual) that packages many of the common data science packages pre-configured for your system. It is a good option for data scientists.
**Pros**
* Many packages and libraries are pre-installed
* Good for data science tooling in Python
**Cons**
* Generally uses [conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) rather than [Python's virtual environments](https://www.geeksforgeeks.org/python-virtual-environment/) - this can lead to a mismatch in instructions when Anaconda is not the primary tool used.
* Packages available here often lag behind in release schedule from PyPI / pip
* Often one whole version behind on Python (e.g. 3.11 rather than 3.12)
**Install steps - Anaconda distribution on Windows**
1. [Download the macOS installer](https://www.anaconda.com/products/individual#)
2. Run the installer, add Python to path if asked
3. Close all terminal and command prompt windows
4. Run `python3 -V` in a new terminal window to verify you have Python now working
_________________________
## Linux
### Step 2. Do you have Python? Let's check
To determine if you have Python installed, open the [**terminal**](https://www.howtogeek.com/140679/beginner-geek-how-to-start-using-the-linux-terminal/). Verify you have Python, in the terminal, type **python3 -V** (capital V):
$ python3 -V
The output should be one of the following (*version numbers will vary*). Don't type **$** - Linux displays this as part of the terminal UI.
#### Success, you have Python
$ python3 -V
Python 3.12.0
If you see this and the reported version number is sufficiently high (often 3.10 or higher), **you are good to go**.
#### 2.7? Uh oh, your Python is badly outdated!
If `python3` **does NOT run successfully**, but `python` (without the 3) itself does and you see the output:
$ python -V
Python 2.7.18
If you have `Python 2.*`, then you are using an outdated version of Python. [**Since 2020, Python 2 has gone entirely unsupported**](https://stackoverflow.blog/2020/04/23/the-final-python-2-release-marks-the-end-of-an-era/) and should not be used. **You will need to continue below to install Python 3**.
#### Ooops, you do NOT have Python
$ python3 -V
bash: python3: command not found
Looks like you do not have Python 3 at all. **You will need to continue below to install Python 3**. Note that the error message is slightly different for different shells.
sudo apt update
sudo apt upgrade
sudo apt install build-essential libssl-dev libffi-dev python3-dev
sudo apt install python3-pip
python3 -V
in a new terminal window to verify you have Python now workingpython3 -V
in a new terminal window to verify you have Python now workingsudo apt-get update
sudo apt-get install -y build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libffi-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
sudo tar xzf Python-3.12.0.tgz
cd Python-3.12.0
sudo ./configure --enable-optimizations
sudo make altinstall
python3.12 --version
python3.12
instead of python
or python3
commandspython3.12
to python
in your shell profile.There is a nice write up of this procedure over here.
If you find a problem or have a suggestion to make this page better, please visit the GitHub repository here. Note that this is not intended for tech support but rather for genuine, broadly applicable improvements to the instructions: