简体   繁体   English

克隆基础conda环境时指定Python版本

[英]Specify Python version when cloning base conda environment

I am trying to create a Python 2 environment on Anaconda3 that clones all of the packages from the base environment.我正在尝试在 Anaconda3 上创建一个 Python 2 环境,该环境从基础环境中克隆所有包。 I know that conda create --name myenv --clone base creates a clone using the currently acquired version of Python, but is there a way to specify the version when doing this?我知道conda create --name myenv --clone base使用当前获得的 Python 版本创建克隆,但是有没有办法在执行此操作时指定版本?

So far I have tried specifying the version like conda create --name test_env --clone base python=2.7 but got the error TooManyArgumentsError: did not expect any arguments for --clone Got 1 argument (python=2.7) but expected 0.到目前为止,我已经尝试指定conda create --name test_env --clone base python=2.7之类的版本,但收到错误TooManyArgumentsError: did not expect any arguments for --clone Got 1 argument (python=2.7) but expected 0.

You don't need to clone the base in this case.在这种情况下,您不需要克隆基础。 For example, I installed the latest Anaconda with version 3.9, but not everything works with it, I needed Python 3.8.例如,我安装了最新的 Anaconda 版本为 3.9,但并非一切都适用,我需要 Python 3.8。

This worked for me:这对我有用:

conda create -n "py38" python=3.8 anaconda 

From below, you can see that it worked:从下面,您可以看到它有效: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM