I have covered changing the default version of python in Debian, however for those looking to Google for a quick fix on Kali, I hope that this reaches you well.
This was tested on a completely fresh install of Kali Linux with no other alterations made prior.
The basic premise is to configure Kali to use python 3.7 at a higher priority to python 2.7 or any other version installed on the system.
Check your python version
Step 1 is to check your current python version:
Kali default output:
Set your Python Default
Now it is time configure the priority for the versions of python that we have installed, 2.7 and 3.5/7. You can list all of the available alternatives installed by running:
To set your version priorities, with 3.7 being the high priority:
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
We have just set 3.7 (2) to have a priority great than 2.7 (1). Now when we list the python priorities we see see 3.7 is higher that 2.7:
update-alternatives --config python
This is also a great way to easily switch those priorities around once they have been set.
Check you default version, again…
Now this command should return the default which you configured above.
Other Useful Python tips:
- https://exitcode0.net/debian-9-how-to-upgrade-python-3-5-to-python-3-7/ – Debian 9 – How to upgrade python 3.5 to python 3.7
- https://exitcode0.net/changing-the-default-python-version-in-debian/ – Changing the default python version in Debian
If you have found this guide useful or it has solved a burning issue for you, please consider throw a coin in the tip jar to help this site stay active: