Download Anaconda installer (Anaconda3-4.3.1-Linux-x86_64.sh) and install it to folder ~/apps/anaconda3 (to uninstall, just remove this folder).
Add the following line into ~/.zshenv:
PATH=/home/leo/apps/anaconda3/bin:$PATH
Create a new environment 'myenv' and executable 'sqlite3' with:
conda create -n myenv sqlite
.
List environments with conda env list
.
Each environment is a folder under '$ANACONDA_HOME/envs'
like which created by virtualenv
.
Go into this environment with . activate myenv
.
Now run which sqlite3
, you can see it's under the current environment folder.
Leave this environment with . deactivate
.
Remove this environment with conda remove -n myenv --all
.
Create a new Python 2.7 virtual environment with
conda create -n py27 python=2.7
, make it the current environment with
source activate py27
. You can use this command to switching between any
conda-managed environment without worrying about nested-virtualenv.
If you met an "no such file or directory: activate" error
when running source activate ...
, use the full path
~/apps/anaconda3/bin/activate
instead of activate
.
Anaconda contains many important Python dev tools, including pip, ipython,
conda (which can be used as a replacement for pip and virtualenv).
If you want use it as the primary Python environment, add $ANACONDA_HOME
before the existing $PATH
.
But Anaconda has no Python 2.x, so at least on Ubuntu 14.04 this is not the recommended way. On Ubuntu 16.04, there is no Python 2.x by default, so use Python 3.5 and pip in Anaconda3 is practical.
Do not add $ANACONDA_HOME
after the $PATH
, which will expose some binary
like conda, jupyter
, while the other (like python and pip) will be covered
by system equivalent. This will lead inconsistent behavior and failure of
conda
and jupyter
.
Ref:
http://www.ericmajinglong.com/2014/09/23/5-great-things-about-the-anaconda-distribution/