I am running latest version of Kali Linux:
uname -a
Linux User 5.14.0-kali4-amd64 #1 SMP Debian 5.14.16-1kali1 (2021-11-05) x86_64 GNU/Linux
It already came with Python 3.9.8. But I needed to install Python 2.7. So I first installed it with sudo apt install python2.7.18. But following happened:
python -V
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
python2 -V
Python 2.7.18
python3 -V
Python 3.9.8
Also:
which python
python not found
WHAT I TRIED:
I checked locations such as /usr/opt/, /usr/bin/, /usr/share/ etc. I checked /usr/bin and found python2 and python3 binaries:
So I reckoned that python environment variable is not set. I added python=/usr/bin/python2 to /etc/environment and then did source /etc/environment. But that did not help.
Then I checked /usr/share and found that python folder Was there.
Then I did some research on the internet and found 
CodePudding user response:
Because that distribution wants to be clear about which version of Python you're running, and it's perfectly allowed to do so.
In short, you'll have to use python3 to run Python 3.x, and python2 (if such a symlink gets set up by pyenv, or if you apt install python2.7 (if it's even available on Kali)) to run Python 2.x.
Please remember Python 2.x is EOL, and you shouldn't use it for any new development.
CodePudding user response:
Manually adding path to /home/bruno/.pyenv/versions/2.7.18/bin to $PATH environment variable solved the python command not found for me, because that directory contains python binary.


