Many computers come with multiple python versions of the standard CPython runtime preinstalled. However, the default meaning of on
python the command-line may not be clear. python is usually an alias for,
python2.7 but it can sometimes be an alias for older versions like
python2.5 To find out exactly which version of Python you’re using, you can use the flag
Python 3 is usually available under the name python3.
You can also figure out the version of Python you’re using at runtime by inspecting values in the sys built-in module.
Python community actively maintains both Python 2 and Python 3. Development on Python 2 is frozen beyond bug fixes, security improvements, and backports to ease the transition from Python 2 to Python 3. Helpful tools like the 2 to 3 and six exist to make it easier to adopt Python 3 going forward.
Python 3 is constantly getting new features and improvements that will never be added to Python 2. Also, Python 2.7 is soon going to retire and will not be maintained past 2020 (refer pep-0373). So, I strongly encourage you to use Python 3 for your next Python project.
Take away from this post📮:
- There are two major versions of Python still in active use: Python 2.x and Python 3.x.
- We have multiple popular runtimes for Python: CPython, Jython, IronPython, PyPy, etc.
- Be sure that the command-line for running Python on your system is the version you expect it to be.
- Prefer Python 3 for your next project because that is the primary focus of the Python community and Python 2.7 support is soon going be come to an end of life.