将Anaconda安装到虚拟环境中 [英] Installing Anaconda into a Virtual Environment
问题描述
我目前可以正常安装想法Python分发在我的计算机上,我不想破坏它,但我想看看移至 Anaconda 来自Continuum.
I've currently got a working installation of the Enthought Python Distribution on my machine that I don't want to necessarily disrupt, but I'd like to look at moving over to Anaconda from Continuum.
我可以轻松地将Anaconda安装到我创建的virtualenv目录中,但是我不确定如何告诉virtualenv使用Python的anaconda版本.如果我告诉整个系统使用它,则可以使用export PATH="/DIRECTORIES/anaconda/bin:$PATH
之类的方式更改.bash_profile
.有没有办法在virtualenv内做到这一点?
I can easily install Anaconda into the virtualenv directory I create, but I'm not sure how to tell that virtualenv to use the anaconda-version of Python. If I was telling my whole system to use it I can alter .bash_profile
with something like export PATH="/DIRECTORIES/anaconda/bin:$PATH
. Is there a way to do that within a virtualenv?
推荐答案
我刚刚从 http://进行了Anaconde 1.6安装程序的测试continentum.io/downloads
下载后,我做了:
bash Anaconda-1.6.0-Linux-x86_64.sh
如果使用默认值,则最终将在主目录中找到目录anaconda
,与EPD或系统Python安装完全分开.
If you take the defaults, you'll end up with a directory anaconda
in your home directory, completely separate from your EPD or system Python installation.
要激活anaconda安装的默认环境,请执行以下操作:
To activate the anaconda installation's default environment, do the following:
source $HOME/anaconda/bin/activate ~/anaconda
所有Python命令现在都来自$HOME/anaconda
中的默认Anaconda环境,该环境本身就是一种虚拟环境.您可以使用以下方式创建子环境: conda create -n myenv1 ipython scipy
,但这不是必需的.
All Python commands will now come from the default Anaconda environment in $HOME/anaconda
, which is itself a kind of a virtual environment. You can create sub-environments with e.g. conda create -n myenv1 ipython scipy
, but this is not necessary.
作为旁注,您还可以使用pip
(也在$HOME/anaconda/bin
中)将PyPI软件包安装到Anaconda默认环境(默认情况下已安装pip
)或任何子环境(在在这种情况下,您应该先使用conda install -n myenv1 pip
将pip
安装到子环境中.)
As a side note, you can also use pip
(also in $HOME/anaconda/bin
) to install PyPI packages into your Anaconda default environment (it has pip
installed by default) or any of the sub-environments (in which case you should first install pip
into the sub-environment using conda install -n myenv1 pip
).
可以将Anaconda的部分手动安装到现有的virtualenv中,但是使用它们的安装程序是迄今为止最简单的测试和使用方式,而不会影响您现有的Python安装.
It is possible to install parts of Anaconda manually into an existing virtualenv, but using their installer is by far the easiest way to test and use, without affecting any of your existing Python installations.
这篇关于将Anaconda安装到虚拟环境中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!