pip is the package installer for Python. On Linux, pip allows for easy installation of Python programs and dependencies. For Python developers, pip is an essential tool.
In the context of Kali Linux, pip is mostly used for hacking scripts or to download dependencies that hacking scripts rely on. Even if you don’t write Python scripts yourself, you may still find it necessary to install pip. In this guide, you’ll see how to install pip on Kali Linux.
Install Pip for Python on Kali Linux
pip can be installed by executing the following commands in terminal.
$ sudo apt update $ sudo apt install python3-pip
Enable Python 2 or Python 3 on Kali
Python 2 has been deprecated, but you might need it if you are running legacy scripts. It’s possible to toggle between Python 3 and Python 2 on Kali.
To enable Python 3:
$ sudo apt install python-is-python3
To enable Python 2:
$ sudo apt install python-is-python2
Installing either of these packages will automatically remove the opposite one. The only thing these packages are doing is changing the symbolic link in /usr/bin/python
.
$ ls -l /usr/bin/python lrwxrwxrwx 1 root root 7 Oct 11 08:34 /usr/bin/python -> python3
How to Use Pip on Kali Linux
Once pip is installed and you have enabled the desired version of Python, you can move on to using pip to install Python programs and dependencies.
1. Install a package with pip:
$ pip3 install [package name]
2. Uninstall a package with pip:
$ pip3 uninstall [package name]
3. List all installed pip packages:
$ pip3 list
4. Show information about an installed pip package:
$ pip3 show [package name]
5. Search PyPI for a pip package to install:
$ pip3 search [search term]
6. To see other commands available for pip, use the -h
(help option):
$ pip3 -h