How install Setuptools for Python on Linux?
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:
- Package and module declarations in Python
- Metadata from the distribution package
- Hooks for testing
- Installation of the project
- Platform-specific information
- Support for Python3
In this article, we will learn how to install Setuptools for Python on Linux.
Installing Setuptools on Linux
Method 1: Using pip to install Setuptools Package
Follow the below steps to install the Setuptools package on Linux using pip:
Step 1: Install the current version of Python3 in Linux.
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 Linux 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
Verifying Setuptools installation on Linux
Use the following import in your Python terminal to verify if the Setuptools installation has been done properly or not:
If we do not get any error while importing the package then is not installed properly.