Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
143 views
in Technique[技术] by (71.8m points)

python - Can I add a channel to a specific conda environment?

I want to add a conda channel to a specific conda environment but when I use

conda config --add channels glotzer

that channel is now available from all my conda environments. In addition to testing an install from another environment, the ~/.condarc file has the following:

channels:
  - glotzer
  - defaults

How would I configure conda so the channel is only available from a specific environment?

I did find in the channel documentation that for conda >= 4.1.0, putting channels at the bottom of the ~/.condarc will prevent added channels from overiding the core package set.

By default conda now prefers packages from a higher priority channel over any version from a lower priority channel. Therefore you can now safely put channels at the bottom of your channel list to provide additional packages that are not in the default channels, and still be confident that these channels will not override the core package set.

I expect this will prevent most problems, except when in one environment you do want the package added through a channel to override a core package.

question from:https://stackoverflow.com/questions/40616381/can-i-add-a-channel-to-a-specific-conda-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As of conda 4.2, environment-specific .condarc files are supported and you can write:

conda config --env --add channels glotzer

to add the channel to the configuration for the active environment.

[Not sure whether --env flag was added in 4.2. Answer based on conda 4.5.9]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...