Can conda install package globally or are all package installed to a specific environment?(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.
有人可以分享这个建议吗?
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 可以全局安装包还是所有包都安装到特定环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:conda 可以全局安装包还是所有包都安装到特定环
基础教程推荐
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 如何在Python中绘制多元函数? 2022-01-01
- 合并具有多索引的两个数据帧 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01