Python 使用 Anaconda 克隆根环境

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30291733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:11:30  来源:igfitidea点击:

Cloning root environment with Anaconda

pythoncloneanaconda

提问by birone

Going through one of (very few available) tutorials on Anaconda, I tried:

通过关于 Anaconda的(非常少的)教程之一,我尝试了:

$ conda create -n rootclone --clone root

This failed:

这失败了:

src_prefix: '/home/bir/conda'
dst_prefix: '/home/bir/conda/envs/rootclone'
Packages: 49
Files: 471
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

    https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.


Traceback (most recent call last):
  File "/home/bir/conda/bin/conda", line 5, in <module>
    sys.exit(main())
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/main.py", line 203, in main
    args_func(args, p)
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/main.py", line 208, in args_func
    args.func(args, p)
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/common.py", line 609, in inner
    return func(args, parser)
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/main_create.py", line 50, in execute
    install.install(args, parser, 'create')
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/install.py", line 170, in install
    clone(args.clone, prefix, json=args.json, quiet=args.quiet)
  File "/home/bir/conda/lib/python2.7/site-packages/conda/cli/install.py", line 91, in clone
    quiet=quiet)
  File "/home/bir/conda/lib/python2.7/site-packages/conda/misc.py", line 177, in clone_env
    data = s.encode('utf-8')
MemoryError

And badly. The environment is created:

而且很糟糕。创建环境:

$ conda info -e
# conda environments:
#
oracle                   /home/bir/conda/envs/oracle
oracleclone              /home/bir/conda/envs/oracleclone
rootclone                /home/bir/conda/envs/rootclone
root                  *  /home/bir/conda

But it's not working at all:

但它根本不起作用:

$ . activate rootclone
discarding /home/bir/conda/bin from PATH
prepending /home/bir/conda/envs/rootclone/bin to PATH
(rootclone)bir@N2C:~/python$ which python
/usr/bin/python   # Should be in /home/bir/conda/envs/rootclone/bin

But is this a true bug, or is conda create -n --clonejust not designed for cloning the conda root environment?

但这是一个真正的错误,还是conda create -n --clone不是为克隆 conda 根环境而设计的?

回答by asmeurer

The MemoryErrorindicates that the conda process ran out of memory. Perhaps you need to allocate more swap memory.

MemoryError指示畅达进程耗尽内存不足。也许您需要分配更多的交换内存。

回答by DevC

Use following command to clone default root environment of Anaconda, the root environment is named as base. This worked for me with Anaconda3-5.0.1

使用以下命令克隆Anaconda默认的root环境,root环境命名为base。这对我有用 Anaconda3-5.0.1

conda create --name <env_name> --clone base