What is the most compatible way to install python modules on a Mac?


The most popular way to manage python packages (if you're not using your system package manager like homebrew) is to use setuptools and easy_install. It is probably already installed on your system. Use it like this:

easy_install django

easy_install uses the Python Package Index which is an amazing resource for python developers. Have a look around to see what packages are available.

A better and more reliable way to install python modules across platforms is to use pip. If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version:

pip install -U pip setuptools

Otherwise:

Download get-pip.py from https://bootstrap.pypa.io/get-pip.py. Run python get-pip.py. This will install or upgrade pip.

Now you can use pip to install python packages. For example, To install the latest version of "SomeProject":

$ pip install 'SomeProject'

To install a specific version:

$ pip install 'SomeProject==1.4'

To install greater than or equal to one version and less than another:

$ pip install 'SomeProject>=1,<2'

Updated on: 01-Oct-2019

170 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements