Reputation: 2240
The title says it. I installed conda and now all my terminals open in the base environment, "(base)" at the start of my prompts. If I type "conda deactivate" it drops out of base to someplace else, like no environment. How is this different from base?
(This question is a tangent from my other, asking if the expected workflow is for me to stay in base: With conda/anaconda should I work in (base) all the time?)
Upvotes: 38
Views: 45969
Reputation: 541
if your already in python interpreter, I usually use this command to show me which path to my Python libraries:
from pprint import pprint
import sys
pprint(sys.path)
Then it shows list of library directories your're working on like this:
['',
'C:\\Program '
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\\python310.zip',
'C:\\Program '
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\\DLLs',
'C:\\Program '
... etc.
The pprint
module is used to make output readable.
Upvotes: 0
Reputation: 1793
Short answer: convenience.
When base
is activated: check out /anaconda3/bin/
you'll find all the binaries that will be included in the $PATH
environment variable (try echo $PATH
in your bash shell)
When base
is NOT activated: basically you only have conda
binary available to use by default. Once again, try echo $PATH
in your bash shell to see the difference.
Upvotes: 4
Reputation: 3832
When playing with python virtual environments in linux (and macOS), it is useful to use the command which python
or which pip
from the terminal. This command shows the path to the currently used python interpreter - that is the thing, together with the location of site packages, that differs one environment from another. The python environment is nothing else but a directory where you have a copy of your python interpreter and installed libraries. Switching from the (base)
to the deactivated (base)
implies switching from one python interpreter to another one - that may be checked using which
.
In windows, the closest equivalent of which
is where
.
Upvotes: 9
Reputation: 731
activating a conda environment is not much more than applying settings to your shell to use a specific python interpreter (and the modules and libs associated to that interpreter)
when you drop out of a conda environment, your shell reverts to the python interpreter determined by your $PATH environment variable -- generally speaking, this default is typically a non-conda environment and is usually the default python installed with the OS (if applicable)
As freude is saying, the obvious way to see this in action is to do which python
as you activate/deactivate environments
Upvotes: 24