Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

virtualenv - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...