分享

Conda

 panhoy 2014-07-03
info

1. conda info

provides information about Anaconda environments.

2. conda info --envs  [conda info -e]

displays the ROOT_DIR Anaconda directory, and test environments within it.

3. conda info --license

displays information about local licenses, including what they are and where they are located.

4. conda info --system
can be used to display the PATH and PYTHONPATH environment variables, which can be useful for the purposes of debugging.

5.  conda info --all

To display all relevant information at once, use the conda info --all option.


List


1. conda list -p  [$ conda list -p ~/envs/test2]

shows the linked packages and their versions in a specific environment directory. --prefix also works. If no prefix is provided, conda will look in the default environment.

2. $ conda list ^py

In this next example, we leave off the prefix and search for packages starting with py in the default directory.


Search

conda search is a versatile option that can be used to explore packages available from known repositories or installed locally.

1. $ conda search scipy

In the first example, we want to simply search for SciPy and see if it is in conda’s list of packages.

2.$ conda search -p ~/anaconda/envs/onlyScipy/

Using the prefix option (-p), we can select an environment, and search for all packages that are compatible with it.

It is also possible to get the same output as the above example by using the name option (-n) with the name of an Anaconda environment.

Create

In this example, we use conda create to make an environment in a directory (specified with -p/--prefix), for one or more packages. We have also chosen to display a progress bar, displayed as it creates the environment.

1. $ conda create -p ~/anaconda/envs/test2 anaconda=1.4.0 python=2.7 numpy=1.6

创建环境并安装 anaconda

We’ll start with an environment created in a specific path (~/anaconda/envs/test2) using the –prefix option (-p).

2. $ conda create --quiet --yes -n foo python

In this next example, rather than selecting an environment directory with a prefix, we will use the name option (-n/--name). This will create an environment in the default Anaconda/envs ROOT_DIR (which can be displayed by using conda info), where it will be discoverable by using conda’s info –envs option.

It is possible to disable a progress bar (--quiet) if you don’t wish to show the status of any packages conda has to download. You can also skip the Proceed(y/n)? check with --yes

Update

conda update replaces old packages in a given environment with the latest versions. Note that Python will not update past the major version that is installed (so for example, if Python 2.7.4 is installed, conda update python will install Python 2.7.7, not 3.4.1).

1. conda update -p /tmp/matplotlib matplotlib

For this first example, we will use an environment /tmp/matplotlib, which we can select using the prefix (-p) option.

2. $ conda update -n matplot matplotlib

For this next example, we will do almost the same thing, but instead of using the prefix option, we will use name (-n) on an environment /home/test/anaconda/envs/matplotlib.



Install

conda install places a package in an environment that may already exist, in this case /envs/myenv.

As before, conda will link all necessary dependencies.

1. $ conda install -p ~/anaconda/envs/myenv scipy


2. $ conda install --yes --quiet -n myenv pandas

In this next example, using the name (-n) option will install a package or packages in an existing environment located in ~/anaconda/envs.

As with conda create, we can use the --yes and --quiet options to automatically answer yes to the confirmation question and hide the progress bar, respectively.



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多