Search code examples
pythonpipcondaminicondavirtual-environment

Is using pip from conda environment folder the same as using that pip executable directly?


Is running

conda activate -n myenv
pip install mypackage

equivalent to running

/opt/anaconda3/envs/myenv/bin/pip install mypackage

?


Solution

  • Yes, they are effectively the same because Conda environment activation prepends the environment's bin/ directory to PATH and therefore the former will evaluate to the latter.

    However, it may be noted that were some non-standard manipulation of PATH or pip-relevant environment variables carried out by activation scripts then there could be a difference. But this is only a note about possibilities, not something encountered in typical use.