4 ms·
Python2 is still what comes installed as stock on many distros. I know Fedora/CentOS ship with it, in part because the package manager Yum/DNF is based in Pytho
by oxguy3 9y ago
Python2 is still what comes installed as stock on many distros. I know Fedora/CentOS ship with it, in part because the package manager Yum/DNF is based in Python2.
- toyg 9y agoThat's not even true anymore. From https://fedoralovespython.org/ https://fedoralovespython.org/ : On Fedora, Python comes pre-installed with first class support for Python virtual environments. It is ready for use straight out of the box. No guessing package names, no installation, just dive in and go. Look: [fedora]$ python3 -m venv env [fedora]$ . env/bin/activate (env) [fedora]$ python ... Note the python3 ... EDIT: wow, 4 downvotes for stating a fact that Fedora developers themselves are shouting from rooftoops. The Python3 hate is strong today.
- OJFord 9y agoBut what's the output of python --version (note not python3)
- maweki 9y agoPEP 394 says that python should point to python2 for the time being. https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/
- toyg 9y agoYup, and it will be reviewed and likely changed at some point: This recommendation will be periodically reviewed over the next few years, and updated when the core development team judges it appropriate. So it's likely that at some point between here and 2020, or in 2020 at worst, the recommendation will change. IMHO Python 3 has now reached a level of maturity and backward-compatibility where it can safely take over as system python. It's now shipped by Fedora, which means the next RHEL will also ship it. Updating old scripts should mostly be a matter of grepping and shebanging from python to python2, and there is now no point in procrastinating further with this move.
- Freak_NL 9y agoAny proper Python script starts with a shebang: #!/usr/bin/env python3 This works on all modern Linux distributions today.
- OJFord 9y agoYes, and if you write it like that, the output of `python --version` has direct consequences for the remainder of the script.