我的 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.
有人可以分享这个建议吗?
Can someone share the suggestion?
conda install
只为当前(激活的)环境安装包.文件将安装在特定环境的目录中.如果您想在所有环境中使用特定包,则必须为每个环境(base
、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 activate
有效,对于旧版本,source activate
适用于 Unix 系统和 activate <环境名称>
适用于 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 可以全局安装包还是所有包都安装到特定环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!