In this tutorial, I’ll show you how to install Python 3 on your computer. Python is a programming language that lets you work quickly and integrate systems more effectively.
Python 3 versus Python 2
Python 3 is strongly recommended over Python 2 because Python 2 has reached End of Life status. As a result, Python 3 will no longer receive updates or bugfixes, including security issues.
Installing Python 3 on a Mac
Option 1 – Use Hombrew
- Open your browser and navigate to http://brew.sh. Command + C the text on the Homebrew site.
2. Open your Terminal app or iTerm application and paste the code from the Homebrew site.
3. This will start the Homebrew installation process. You may be prompted to install the Command Line Developer Tools.
4. When the Homebrew installation process finishes, you can install Python3 by running the following command on your Terminal window.
$ brew install python3
This will install python3 using Homebrew. You can test if your installation was a success by opening your Terminal window and typing:
Option 2 – Download from Python.org
Installing Python 3 on a PC
1. Navigate to the Windows downloads section of Python.org and download the latest package.
2. When you download the package, an installation wizard will appear to install Python 3 on your computer.
Installing Python3 on a Linux Machine
1. Install required dependencies to build Python.
$ sudo apt update $ sudo apt install build-essential zlib1g-dev \ libncurses5-dev libgdbm-dev libnss3-dev \ libssl-dev libreadline-dev libffi-dev curl
$ sudo dnf groupinstall development
2. Navigate to Python.org and download the latest version of Python 3. After you download the file, you will have a .tar.xz archive (tarball) containing the source code of Python.
3. Extrack the tar.xz archive using your preferred method of choice.
$ tar -xf Python-3.?.?.tar.xz
4. Once the Python tarball has been extracted, navigate to the configure script and execute it in your Linux terminal with:
$ cd Python-3.* ./configure
5. Now you can start the build process.
$ make $ make install
6. You can verify whether it succeeded by typing in
$ python3 --version