在没有python的情况下创建了新的conda环境 [英] New conda environment is created without python

查看:38
本文介绍了在没有python的情况下创建了新的conda环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

conda 文档 说当你使用

conda create --name myenv

新环境

使用与您当前使用的相同版本的 Python,因为您没有指定版本.

uses the same version of Python that you are currently using because you did not specify a version.

然而,我的情况并非如此.我有 Windows 10 和 Anaconda.我进入了默认创建的基础"环境.

However, that's not the case for me. I have Windows 10 and Anaconda. I am into the "base" environment created by default.

如果我跑

conda create --name testenv

然后当我激活环境

conda activate testenv

没有 Python.如果我写

There is no Python. If I write

python

打开 Microsoft Store 的控制台.

to the console the Microsoft Store is opened.

要拥有一个 Python 解释器,我需要手动指定它

To have a Python interpreter I need to manually specify it

conda create --name testenv2 python=3.8

推荐答案

Conda 文档中的特定注释是 Conda v4.4 之前的保留内容,此后已更正(请参阅 此处此处).

That specific note in the Conda documentation was a hold-over from before Conda v4.4 and has since been corrected (see here and here).

在 Conda v4.4 之前,base 环境的 bin/ 目录总是在 PATH 上,因此为什么不安装 Python 解释器在新环境中,它将回退到基础 Python.Conda v4.4 引入了一种管理环境隔离的新策略,通过将 Conda 的主要接口定义为一组 shell 函数并允许 base bin 目录仅包含在PATHbase 环境处于活动状态时.此策略提供了更清晰的环境隔离,这意味着只有活动环境中的内容才可用.

Previous to Conda v4.4, the base environment's bin/ directory was always on the PATH, hence why not installing a Python interpreter in a new environment it would fall back to the base Python. Conda v4.4 introduced a new strategy for managing environment isolation via defining the primary interface to Conda as a set of shell functions and allowing the base bin directory only to be included on PATH when the base environment was active. This strategy provides cleaner isolation of environments, which means that only what is in the active environment will be available.

因此,如果您想在环境中使用 Python,则必须显式安装它.

Hence, if you want Python in the environment, it must be explicitly installed.

这篇关于在没有python的情况下创建了新的conda环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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