pythonvirtualenvsublimetext3osx-yosemiteanaconda

Anaconda Python: where are the virtual environments stored?


I am new to Anaconda Python and I am setting up a project in Sublime Text 3. I have installed Anaconda and created a virtual environment using:

conda create -n python27 python=2.7 anaconda
conda create -n python35 python=3.5 anaconda

I am having trouble setting up the Virtualenvs plugin for SublimeText 3.

When I try, it asks me for a virtualenvs path which I give:

~/users/../anaconda/envs/python27

Then it asks for what I'm assuming is a path to a python distribution because it lists file paths for the system versions of python -- but not the anaconda install.

I have no real desire to use the plug in, I just want to be able to use both versions of python. Could I use a project settings file to set the version of python instead?


Solution

  • If you activate the environment you're interested in, you can find that answer in the environment variables.

    on MacOS/Linux:

    source activate python35
    echo $CONDA_PREFIX
    

    on Windows:

    conda activate python35
    echo %CONDA_PREFIX%
    

    You can also run conda info --envs, and that will show the paths to all your environments.

    To get the path to the instance of python being used by a particular environment, do the following:

    on MacOS/Linux:

    source activate python35
    which python
    

    on Windows:

    conda activate python35
    where python
    

    That should return the path you're looking for.