I've been using this term with a loose understanding as heard in the phrases "uses base python", "built on base python" that basically suggests a python project that only depends externally on Python Standard Library modules alone.
I've recently been exposed to the lingo of system python
, and seeing comments like # SYSTEM IMPORTS
heading off a series of base python imports in some of the code I've been following.
From what I've gathered system python is really just a python installation that comes with a system, as in the canonical /usr/bin/python
executable. It can be expanded to include third party packages like any python installation, so it seams these comments are suggesting default system python installation modules, which to me is really getting at Base Python because I could have a default installation of Anaconda, Jython, IronPython, etc and they'd all share the same base installation setup of the standard library. To me it is the connection to the standard library that what really counts, not where the installation is to be found.
Is it imprecise to refer to standard library modules as system imports? Seems to conflate the two. I was surprised too that there's so much colloquial use of "base python" online in SO Q/A but there's not much of a formal definition online. What I find instead online is hits for base classes and integer base representation, so given that...
- What is Base Python?
- What is System Python?
- What's the difference?
3 Answers 3
Without the context where the terms comes from, guessing its meaning is no easy task.
system imports
Querying the python documentation for the terms "system imports" bears no interesting result. Yes, it is imprecise to refer to standard library modules as system imports.
system python
Specific reference for system python as in /usr/bin/python
might be important (even critical) for your system since it is probably used by the system itself for administrative puproses.
For instance, the yum
utility for managing packages in the RHEL/CentOS/Fedora familly of Linux distributions internally uses the /usr/bin/python
system python. I have seen it completly break after a pip install -U requests
because of some backward compatibility breakage in that library.
Put simply, do not install anything within the system python if you don't know what you're doing. (you may have a hard time fixing yum
using yum
if yum
is broken)
(running sudo pip install
is often asking for troubles)
base python
May refer to the Python interpreter that was used to create a given virtual environment, this is the parent interpreter relative to another given (virtual) interpreter. It may fortuitously refer to a system python.
-
Nice link there of the search results, that's a brilliant strategy I never considered. Gonna add it to my toolbox thank you very much.jxramos– jxramos2018年04月20日 04:03:37 +00:00Commented Apr 20, 2018 at 4:03
-
Your
venv
connection to base has a locus of Google hits: base python as the default root where further python virtual environments branch from. I've come across sites using language of base interpreter, base environment, base python modules, base python installationjxramos– jxramos2018年04月20日 04:26:46 +00:00Commented Apr 20, 2018 at 4:26 -
Hey check this out, the docs internal search may be lacking but googling
site:docs.python.org "base python"
yields this goody sys.base_exec_prefix ...whereasbase_prefix
andbase_exec_prefix
will remain pointing to the base Python installation (the one which the virtual environment was created from).jxramos– jxramos2018年04月20日 04:36:38 +00:00Commented Apr 20, 2018 at 4:36
Here's some associations care of google autocomplete surrounding base python...
- base python packages
- base python libraries
Put simply base python refers to the python interpreter and the standard library alone.
The term system python refers to a python installation that ships with the system/OS, which is to say comes preinstalled. It's worth noting that calling something system python isn't a declaration that it was installed in the system binaries folder /sbin
.