Install Pip On Osx

Usb

Python is very popular programming and scripting language. It provides useful modules and libraries but also there is a lot of popular 3rd party library. Pip is the command and tools used to install, update and remove 3rd party packages. In this tutorial, we will learn how to install pip and some useful information.

Check and Display Python Version

Pip is a tool for installing and managing the python packages. Like Python, pip can be installed on all operating systems. Python: install pip. To install the latest version of pip, run the below command in MacOS, $ sudo easyinstall pip $ sudo pip install -upgrade pip To install the pip in the Ubuntu, use the apt-get manager. Apple’s Mac OS comes with python 2.7 installed by default. Perhaps you may want to use python 3.x.x on your machine and also use pip for package management with python 3.x.x. The easiest way to achieve this is by: NOTE: This tutorial does not use Virtual Environments like virtualenv or pyenv to manage various python versions.

Before installing the pip we have to be sure that Python is installed. Also, the version of the Python is important because pip will be installed according to this Python version.

We can see that both PYthon2 and PYthon3 is installed. So we can use installation commands for both Python2 and Python3. The python2 version is Python2.7.16 and Python3 version is Python3.6.8 .

Install Pip with easy_install On MacOS

Install Pip On Osx

easy_install is a Python module bundled with setuptools which gives us the ability to download, build, install, and manage Python packages. Before pip easy_install was the standard package manager for the Python. We can install pip with the easy_install command like below.

Install pip on mac using brew

Install Pip On Mac M1

If the pip is already installed we can also upgrade the existing pip installation with the easy_install like below. We will use the pip command because it installed already and provide the --upgrade option with the package name which is also pip.

Install Pip with get-pip.py On MacOS

get-pip.py is another way to install pip in MacOS. get-pip.py is a Python script that will simply download and install the Pip package for Python. First, we will download the get-pip.py script with the curl command. We will provide the URL with the -o option where we will set the name of the downloaded get-pip.py file name.

Install Pip On Osx

AND then we will call the get-pip.py with the Python interpreter. This will run the get-pip.py file Python codes which will simply install the pip for the macOS or OS X.

Install Pip with brew On MacOS

Homebrew is the package management tool for the macOS. We can use Homebrew in order to install Python and pip. pip is provided with the python package. We will use brew command with the install command like below.

If there are problems related to the pip usage we may need to relink the python with the following command.

Check and Display Pip Version

We can check installed pip version with the -V or --version option like below.

We can see that Python2 pip version is pip 9.0.1 and Python3 pip version is pip 9.0.1 . They are the same version for both Python2 and Python3. This is because to prevent version conflicts and synchronize the feature development of the pip command for both Python versions.

Apple’s Mac OS comes with python 2.7 installed by default. Perhaps you may want to use python 3.x.x on your machine and also use pip for package management with python 3.x.x. The easiest way to achieve this is by:

NOTE: This tutorial does not useVirtual Environments like virtualenv or pyenv to manage various python versions

1. Installing python3

  • Follow this link and download the latest python3OS X package
  • Run the package and follow the steps to install python3 on your computer.
  • Once the installation is done, on your Terminal, run

This will print out the version of python installed on your system. The output should be similar to:

You may verify the installation directory of python by runningthe following line on the Terminal.

The prompt should print the install path for python3. An example output is:

Install Pip On Osx

2. Install pip3:

  • Securely download the get-pip.py file from this link
  • From the directory where the file was downloaded to, run the following command in the Terminal
  • Once the installation completes you should see the prompt print message similar to this
  • Verify the installation of pip3 by running the following on the Terminal

Install Pip On Osx Emulator

This should return the install location of pip3.

  • To install python3 packages using pip3, run

Install Pip On Mac Python 3

Remember to replace packageName with the appropriate package name for your case.

Install Pip On Mac Using Brew

Happy Pythoning!