Command to display active conda channels

允我心安 提交于 2021-02-08 13:23:26

问题


Is there a command to display active conda channels?

I know I can search for the .condarc file to check for any added channels. However, there are two problems with this approach:

  1. The default channels might change on newer version of conda. For example, since conda 4.7, the free channel has been removed from the default channels. Another example is the addition of channel main in conda 4.3.27.
  2. No unified way to display channels (that is open file contents) in different OS.

Therefore, a command is necessary for viewing active conda channels. Does such a command exist? I have conducted a web search, but have I have not found something.


回答1:


In addition to conda info, one can also query configuration info specifically with the conda config --show [key] command. For high-level channel names, one can use

conda config --show channels

which outputs what you'd see in the .condarc, i.e., just the names of the channels, no URLs. The URLs used in defaults can be queried separately,

conda config --show default_channels

which for me gives,

default_channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r



回答2:


By executing:

conda info

It displays information about conda, including current channels. More specifically, it displays the URL of the channels. For example, the channels listed in a freshly installed conda environment using default conda settings in an Ubuntu 16.04 64bit OS are:

channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
               https://repo.anaconda.com/pkgs/main/noarch
               https://repo.anaconda.com/pkgs/r/linux-64
               https://repo.anaconda.com/pkgs/r/noarch

You can distinguish the channel name from the URLs. In the above example, the channels listed are main and r.



来源:https://stackoverflow.com/questions/57779829/command-to-display-active-conda-channels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!