非分隔蟒蛇环境有什么用? [英] What is the use of non-separated anaconda environments?

查看:83
本文介绍了非分隔蟒蛇环境有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在创建conda环境时未指定python版本:

I noticed that when a conda environment is created without specifying the python version:

conda create --name snowflakes 

代替:

conda create --name snowflakes python=3.6

环境没有分开,并与默认的python解释器共享软件包.

the environments are not separated and share the package with the default python interpreter.

于是,非分隔的蟒蛇环境有什么用?

Thereupon, What is the use of non-separated anaconda environments?

编辑-20170824: 这个问题已经解决了.实际上,没有不可分隔的环境.使用第一个命令时,没有安装新的Python解释器,因此它调用PATH中找到的第一个是标准的Python解释器,因为没有其他解释器.

EDIT - 20170824: The question has been solved. Actually non-separated environments do not exist. With the first command there is no new Python interpreter installed so that it calls the first that it finds in the PATH being the standard Python interpreter because there is no other.

推荐答案

我认为您在文档中误解了"separate"一词.在文档中,它们的意思是分开",即创建新环境,并使用新名称尝试一些新事物".它们并不意味着您正在创建另一种conda环境. conda中只有一种环境,即您所说的分离"环境.所有环境中的所有程序包始终是唯一的.碰巧第一个命令创建了一个没有软件包的空环境.因此,在激活新环境后,PATH环境变量如下所示:~/miniconda3/envs/snowflakes/bin:~/miniconda3/bin:...现在,由于在~/miniconda3/envs/snowflakes/bin中未安装Python(因为snowflakes环境为空),因此Shell仍在其中找到Python. ~/miniconda3/bin作为路径上的第一个. snowflakes环境与根环境不共享.例如,如果在创建后键入conda install -n snowflakes python,它将安装将找不到任何软件包的Python新版本!因此,conda中只有一种环境,即您所说的分离"环境.

I think you are misunderstanding the word "separate" in the docs. In the docs, they mean "separate" in the sense of "create a new environment, with a new name to try some new things". They do not mean that you are creating a different kind of conda environment. There is only one kind of environment in conda, what you are calling the "separated" environment. All packages in all environments are always unique. It so happens that the first command creates an empty environment with no packages. Therefore, when the new environment is activated, the PATH environment variable looks like: ~/miniconda3/envs/snowflakes/bin:~/miniconda3/bin:... Now, since there is no Python installed into ~/miniconda3/envs/snowflakes/bin (because the snowflakes environment is empty), the shell still finds Python in ~/miniconda3/bin as first on the path. The snowflakes environment does not share with the root environment. For instance, if, after creating, you type conda install -n snowflakes python it will install a new version of Python that won't find any packages! Therefore, there is only one kind of environment in conda, what you are calling the "separated" environment.

这篇关于非分隔蟒蛇环境有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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