Tuesday, December 6, 2016

How to use Anaconda

Anaconda is a one stop distribution of Python related scientific computing components. Probably its convenience is more obvious on Windows instead of Linux. Following is some summary of how to use conda on Windows platform.
To avoid anything unexpected happened, suggest to start Anaconda by choosing from start menu and launch the Anaconda Prompt.

1. Show all virtual environments created:
conda info --envs

2. Activate specific environment, like root:
activate root

3. Deactive specific environment, like root:
deactivate
There’s no need to append the option value since the command is aware of which environment it's currently in.
However, try not to deactivate the default root environment, since on *nix platform, it will try to remove Anaconda path variable from current shell environment variable. What you need to do is just switch to another virtual environment, and conda is clever enough to deactivate the previous one.

4. Create specified environment (here take “default” as an example) and initially with specified lib to be installed (here take “matplotlib” as an example):
conda create -n default matplotlib 

5. Create specified environment (for instance “default”) by clone another (here root)
conda create -n default --clone root

6. List the packages installed into specified environment (for instance “default”):
conda list -n default

7. Install package (here with option value “tensorflow”) into the current environment:
conda install tensorflow

8. Install package (as an example, “tensorflow”) into the specified environment (here with name root):
conda install -n root tensorflow

9. Search uncommon package in Anaconda website:
anaconda search -t conda package-name 

10. Show detail about found package
anaconda show user/package-name

11. Install specific package from specified channel:
conda install --channel https://conda.anaconda.org/user package-name

12. Install specific package (like tensorflow) with pip (it’s recommended to do in some virtual environment) by virtue of auto-resolving dependency:
pip instll tensorflow

No comments:

Post a Comment