Python (Scripting) - Install module using setup.py
by
Jeremy Canfield |
Updated: May 09 2023
| Python (Scripting) articles
Almost always, pip install is used to install a package. However, there are some edge cases where it makes sense to install a package using the python setup.py install command. For example, I had a situation where I needed to create a virtual environment with Python version 2 but my Python version 2 did not have the virtualenv module.
~]# python -m virtualenv my_virtual_env
/usr/bin/python: No module named virtualenv
So I went over to https://pypi.org/project/virtualenv/ and downloaded virtualenv-20.23.0.tar.gz and placed this tar archive on my Linux system that had Python 2 and then used the tar extract command to extract the tar archive.
~]$ tar -zxpf /tmp/virtualenv-20.23.0.tar.gz --directory /tmp
And then ran the python setup.py install command to install the virtualenv module into Python 2.
cd /tmp/virtualenv-20.23.0
sudo python setup.py install
Did you find this article helpful?
If so, consider buying me a coffee over at