What is the purpose of the c flag in the “conda in

2019-07-18 23:15发布

I'm learning to setup python environments using conda, and I noticed that on the anaconda cloud website they recommend installing packages using the sintax

conda install -c package

However on the conda documentation they use the same command without the c flag.

Could anyone explain to me what is the purpose of the c flag and when should it be used?

2条回答
祖国的老花朵
2楼-- · 2019-07-18 23:32

-c stands for --channel. It's used to specify a channel where to search for your package.

For example, let's say you want to download pytorch. You can search on anaconda.org. You'll see that pytorch is owned by pytorch. Then, you'll just have to do a:

conda install pytorch -c pytorch

查看更多
神经病院院长
3楼-- · 2019-07-18 23:46

Copied from CLI after running conda install -h:

-c CHANNEL, --channel CHANNEL

Additional channel to search for packages. These are URLs searched in the order they are given (including file:// for local directories). Then, the defaults or channels from .condarc are searched (unless --override-channels is given). You can use 'defaults' to get the default packages for conda, and 'system' to get the system packages, which also takes .condarc into account. You can also use any name and the .condarc channel_alias value will be prepended. The default channel_alias is http://conda.anaconda.org/.

Channels are locations where Navigator and conda look for packages. (source) A package with the same name may exist on multiple channels. If you wish to install from other than the default channel, than one way of specifying which channel to use, is to use the conda install -c channel_name package_name syntax. Also read this for a description of install process using channels.

查看更多
登录 后发表回答