Conda environments tutorial
It is just a list of strings that specifies the search path for modules. Refer to the official doc for more details.
It is populated in two steps:
The first item of this list, sys.path[0], is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the interpreter is invoked interactively or if the script is read from standard input), sys.path[0] is the empty string, which directs Python to search modules in the current directory first.
Then the entries defined in the environment variable PYTHONPATH are appended to sys.path.
Afterwards, the sys.path is the populated by the module site (which is automatically imported on startup, python -S avoids it) according to the following steps:
sys.prefixsys.prefix + site_packages_tailsys.exec_prefixsys.exec_prefix + site_packages_tailwhere site_packages_tail is lib/site-packages (on Windows) or lib/pythonX.Y/site-packages (on Unix and Macintosh)
*.pthfiles and add their contents to sys.path. Execute also any import statement.sitecustomize.py module if it is found in the path already added to sys.pathusercustomize.py module if it is found in the path already added to sys.pathThe final status of the sys.path variable and user-specific directories can be checked by doing:
python -m site
Show conda configurations. Useful to identify which channels, packages (to pip or not to pip) it is using by default:
conda config --show
Environments created by conda are not fully independent of others. For example, if you do:
conda create -c conda-forge -n env1 python=3.5
activate env1
pip listing this new environment will show packages in the new environment but also those in the USER_SITE (https://github.com/conda/conda/issues/394). To create fully isolated environments set the environment variable
PYTHONNOUSERSITE=1
Create an environment called env1 in D:\Users\username\.conda\envs\:
conda create -p D:\Users\username\.conda\envs\env1
Check results by showing the list of existing environments:
conda info --envs