Open In App

How to set up Setuptools for Python on MacOS?

Setuptools is a package development process library that extends the Python standard library distutils to make it easier to package Python projects (distribution utilities). It contains the following features:

In this article, we will learn how to install Setuptools for Python on macOS.



Installing Setuptools on MacOS

Method 1: Using pip to install Setuptools Package

Follow the below steps to install the Setuptools package on macOS using pip:



Step 1: Install the current version of Python3 in macOS. 

Step 2: Check if pip3 and python3 are correctly installed in your system using the following command:

python3 –version

pip3 –version

Step 3: Upgrade pip3 to avoid errors occurring during the installation process.

pip3 install –upgrade pip

Step 4: Enter the following command to install Setuptools using pip3.

pip3 install setuptools

Method 2: Using setup.py to install Setuptools

Follow the below steps to install the Setuptools package on macOS using the setup.py file:

Step 1: Download the latest source package of Setuptools for Python3 from the website

curl https://files.pythonhosted.org/packages/69/77/aee1ecacea4d0db740046ce1785e81d16c4b1755af50eceac4ca1a1f8bfd/setuptools-60.5.0.tar.gz > setuptools-60.5.0.tar.gz

Step 2: Extract the downloaded setuptools package using the following command:

tar -xzvf setuptools-60.5.0.tar.gz

Step 3: Go to the setuptools-60.5.0 folder and enter the following command to install the package.

cd setuptools-60.5.0

python3 setup.py install

Note: You must require developer tools for XCode MacOS installed in your computer system.

Verifying Setuptools installation on macOS

Use the following import in your Python terminal to verify if the Setuptools installation has been done properly or not:

import setuptools

If we do not get any error while importing the package then is not installed properly.

Article Tags :