conda可以在全球范围内安装软件包还是将所有软件包都安装到特定的环境? [英] Can conda install package globally or are all package installed to a specific environment?

查看:249
本文介绍了conda可以在全球范围内安装软件包还是将所有软件包都安装到特定的环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在conda管理下有多个环境,如下所示

I have multiple environments under my conda management, as shown below

ss-MacBook-Pro$ conda env list
# conda environments:
#
base                  *  /miniconda2
testenv                  /miniconda2/envs/testenv
testenvpy3               /miniconda2/envs/testenvpy3

我可以安装在多个环境中都有效的软件包吗?通过阅读文档,我的印象是不可能的,因为如果我这样做

Can I install a package that becomes effective across multiple environments? By reading the documentation, I got the impression that it is NOT possible, because if I do

conda install package-name

它将仅安装到 base 环境(当前活动环境)中,但不适用于其他环境。我记得以前可以通过某种方式在virtualenv下实现对多个环境有效的软件包。

it will only get installed into the base environment (the current active environment), but it does not apply to other environments. I remember I can somehow achieve install a package effective to multiple environments under virtualenv before.

有人可以分享建议吗?

推荐答案

conda install 仅安装当前(激活)环境的软件包。文件将安装在特定环境的目录中。如果要在所有环境中使用特定的程序包,则必须针对每个环境 conda安装该程序包(基本 testenv testenvpy3 )。

conda install only installs packages for the current (activated) environment. Files will be installed in the directory for the specific environment. If you want a specific package in all environments, you'll have to conda install that package for each of your environments (base, testenv, testenvpy3).

到在各种环境之间切换,只需激活要切换到的环境即可。语法取决于Anaconda版本或您的操作系统。对于较新的Anaconda版本, conda激活< env名称> 起作用,对于较旧的版本, source激活< env名称> 对于Unix系统,激活< env名称> 对于Windows。

To switch between environments you just need to activate the one you switch to. The syntax depends Anaconda version or your OS. For newer Anaconda versions, conda activate <env name> works, and for older versions, source activate <env name> for Unix systems and activate <env name> for Windows.

我确定您已经已经看过了,但是这里有一个有用的链接

I'm sure you've looked at this already, but here's a helpful link.

这篇关于conda可以在全球范围内安装软件包还是将所有软件包都安装到特定的环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆