問題描述
我目前已經(jīng)安裝了 Enthought Python Distribution在我不想破壞的機(jī)器上,但我想看看轉(zhuǎn)移到 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 安裝到我創(chuàng)建的 virtualenv 目錄中,但我不確定如何告訴 virtualenv 使用 Python 的 anaconda 版本.如果我告訴我的整個系統(tǒng)使用它,我可以用 export PATH="/DIRECTORIES/anaconda/bin:$PATH
之類的東西來更改 .bash_profile
.有沒有辦法在 virtualenv 中執(zhí)行此操作?
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 安裝程序continuum.io/downloads
下載后,我做了:
bash Anaconda-1.6.0-Linux-x86_64.sh
如果您采用默認(rèn)設(shè)置,您最終會在您的主目錄中獲得一個目錄 anaconda
,與您的 EPD 或系統(tǒng) 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 安裝的默認(rèn)環(huán)境,請執(zhí)行以下操作:
To activate the anaconda installation's default environment, do the following:
source $HOME/anaconda/bin/activate ~/anaconda
所有 Python 命令現(xiàn)在都來自 $HOME/anaconda
中的默認(rèn) Anaconda 環(huán)境,它本身就是一種虛擬環(huán)境.您可以使用例如創(chuàng)建子環(huán)境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 默認(rèn)環(huán)境中(它具有 pip
默認(rèn)安裝)或任何子環(huán)境(在這種情況下,您應(yīng)該首先使用 conda install -n myenv1 pip<將
pip
安裝到子環(huán)境中/code>).
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 手動安裝到現(xiàn)有的 virtualenv 中,但使用它們的安裝程序是迄今為止測試和使用的最簡單方法,不會影響您現(xiàn)有的任何 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.
這篇關(guān)于將 Anaconda 安裝到虛擬環(huán)境中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!