How to Install Python 3 on Kali Linux
Last Updated :
01 Mar, 2024
Python 3 is a powerful and versatile programming language widely used for various tasks, from web development to data science, security automation, and AI and ML. Recent versions of Kali Linux come with Python 3 pre-installed. For some reason if you want a different version than the one already installed or you're using an old version of Kali Linux which doesn't have python 3 pre-installed. In this article, we will install Python 3 using two methods
Method 1 : Using APT package manager
Step 1 : Update package list
To make sure we are getting latest version of python, update package list using apt update command.
sudo apt update -y
updating package listStep 2 : Install Python 3
Once repositories are up to date, we will install python using apt install command.
sudo apt install python3 -y
installing python using apt commandStep 3 : Verify installation
Once, installation is done, verify installation using python --version command.
python --version
verifying installation
Method 2 : Compiling from sources
Step 1 : Installing dependencies
In order to install python 3 from Tarball package, we will need to download required dependencies using apt install command as follows
sudo apt install build-essential zlib1g-dev libncurses-devlib libgdbm-dev libnss3 libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev -y
Installing dependenciesStep 2 : download archive
In this step, we will download official Tarball package from official python repository using wget command.
wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz
downloading Tarball packageStep 3 : Extract the archive
Once downloading is completed, we will extract the package using tar -xvf command.
tar -xvf Python-3.12.2.tgz
extracting downloaded archive using tar -xvf commandStep 4 : Navigate to the extracted directory
Once extracted, navigate to extracted directory using cd command.
cd Python-3.12.2
navigating to Python directoryStep 5: Configure and build
Once we are in extracted python directory, use following commands to make configurations and installation.
./configure
configuring python for installationOnce configuration is done, we will install python with make install command.
sudo make install
installing pythonStep 6 : Verify installation
Once, installation is done, verify installation using python --version command.
python --version
Conclusion
In this article we have discussed two methods for installing Python 3 in Kali Linux. For most users, the recommended approach is to use the Kali repositories (using APT Package Manager) for ease of installation, compatibility, and regular security updates. However, if you have specific requirements or need to install a development version, compiling from source can be an option.
Similar Reads
How to Install Python-sh on Linux? In python, the sh package is a full-fledged sub-process replacement for Python 2.6 - 3.8, PyPy, and PyPy3 that allows you to call any program as if it were a function. So, in this article, we will be installing the sh package in Python on Linux operating system. Installing Sh package on Linux using
1 min read
How to Install Python-arrow on Linux? Arrow is a Python library for performing tasks with date and time. It presents a sensible and human-friendly approach to creating, manipulating, formatting, and converting dates, times, and timestamps. Arrow allows easy creation of date and time instances with timezone awareness. So, in this article
1 min read
How to Install Python-Amara on Linux? Amara is a Python library for XML processing in a Python environment, designed to balance the native idioms of Python with the native character of XML. Amara is a cross-platformed library that works on Windows, Linux, and macOS. So in this article, we will be installing the Amara package in Python o
1 min read
How to Install Dash in Python on Linux? Dash library in Python is a framework developed to create custom web analytic applications. Dash library has a custom user interface which makes it beat for building data analysis applications. Dash library is a cross-platformed library that works on various operating systems like Windows, Linux, an
1 min read
How to Install Python docutils on Linux? Docutils is an open-source text processing system. It is written in Python language. It is used to process simple text or plaintext documents into some useful formats like LaTex, HTML, OpenDocument, XML, etc. It is easy to use and easy to read. It is available for operating systems like, Windows, ma
2 min read
How to Install Kali Linux on Windows? Kali Linux is an open-source Linux distribution based on Debian, designed for sophisticated penetration testing and security auditing. Kali Linux includes hundreds of tools for diverse information security activities such as penetration testing, security research, computer forensics, and reverse eng
2 min read