Overview

In this article, I'll provide instructions for installation of Python3 and Pip3 on Windows, macOS, and Linux/Unix.

Why Python 3?

Python 2.x is legacy, Python 3.x is the present and future of the language

For more difference between python2 and python3 checkout the link: https://wiki.python.org/moin/Python2orPython3

Table of contents

  • Installation in Ubuntu
  • Installation in macOS
  • Installation in Windows

Installation in Ubuntu

First update your repository:

sudo apt-get update

To install python3, run command:

sudo apt-get install python3

To install pip3, run command:

sudo apt install python3-pip

Now, check your installation by running:

python3 -V

# Output
Python 3.6.6 

Installation in macOS

You can easily install Python 3 (along with the pip3 tool) from python.org:

  1. Download the required installer:
    1. Go to https://www.python.org/downloads/
    2. Select the Download Python 3.7.2 button (the exact minor version number may differ).
  2. Locate the file using Finder, and double-click the package file. Following the installation prompts.

You can now confirm successful installation by checking for the Python 3 as shown below:

python3 -V

# Output
Python 3.7.2

You can similarly check that pip3 is installed by listing the available packages:

pip3 list

Installation in Windows

  1. Download the required installer:
    1. https://www.python.org/downloads/
    2. Select the Download Python 3.7.2 button (the exact minor version number may differ).
  2. Locate the file using Finder, and double-click the package file. Following the installation prompts.
  3. Be sure to check the box labeled "Add Python to PATH"

You can now confirm successful installation by checking for the Python 3 as shown below:

py -3 -V
# Output
Python 3.7.2

 

The Windows installer incorporates pip3 (the Python package manager) by default. You can list installed packages as shown:

pip3 list
Note: The installer should set up everything you need for the above command to work. If however you get a message that Python cannot be found, you may have forgotten to add it to your system path. You can do this by running the installer again, selecting "Modify", and checking the box labeled "Add Python to environment variables" on the second page.

If the problem still persist, you can set your path manually:

  • Right click on This PC and click on properties
  • Next, click on the ‘Advanced system settings
  • Finally, click on the ‘Environment variables…
  • That should take you to the Environment Variables screen, where you can add new paths.
  • Click on ‘New…‘ which is located under the User variables box.
  • You should then see the following box, which will allow you to add new variables.
  • Before you type any values, you’ll need to locate the relevant Python paths. The paths that you’ll need to get are:
  • The Python application path, which is the folder where you originally installed Python; and
  • The Python Scripts path. The Scripts folder should be located within the Python application path.
  • Now let’s fill the New User Variable box that you saw earlier:
  • For the Variable name, you may type a name, such as ‘Path’ for example.
  • For the Variable value, copy the full Python application path, then use semicolon (as highlighted in yellow below), and finally copy the Python Scripts path.
  • This is how my Variable value would look like:
  • C:\Users\Nitin\AppData\Local\Programs\Python\Python37-32;C:\Users\Nitin\AppData\Local\Programs\Python\Python37-32\Scripts
  • Press ‘OK’ and you would then see your new Python Path under the ‘User variables’ section. Don’t forget to press ‘OK’ again so that the changes will get implemented.
  • That’s it! You just added Python to the Windows Path.