-
Notifications
You must be signed in to change notification settings - Fork 77
Python 2 vs Python 3
A long time ago in a galaxy not really all that far away, there was only one official version of Python, which was anointed Python 2, and the people rejoiced and were glad.
About a decade later, Python decided to make improvements to the language which were not backwards compatible, which was anointed Python 3, and lo! the people were not rejoiced, and were not glad, in fact they were pretty pissed.
And so, while some people worked to migrate their code to Python 3, others rebelled and did not budge from Python 2. And there was tumult and unrest in the land, for a short time, like 10 years.
But we are pretty much past that, and most of the world has now moved to Python 3, and so we don't have to have the argument about which is better. However, we are left with the residual detritus of this battle, i.e. there now exist both "python2" and "python3" directories, packages, paths, etc. Which opens things up for confusion and mistakes - e.g. you may type in 'python', and on one OS/version you may be running Python 2, and on another, Python 3.
For example, on this current system I'm running Kali Linux 20, and when I just run 'python' from a terminal, I'm running Python 2.7.18. On my Ubuntu 20.04 LTS system, I can't even run 'python' - I have to run 'python2' or 'python3'. So the moral of the story: just be careful you are running the right version of Python.
That said, I find myself unconsciously using, and appreciating, new features in the most recent versions of Python 3.8, so it does seem like the language is moving in the right direction.
The easiest way - which isn't "easy" per say, just more deterministic - is to get used to always running python with "python3", and running pip (installer) with "pip3".