Python 创建空的 conda 环境
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35860436/
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
Create empty conda environment
提问by blueFast
I can create a new conda environment, with program biopython
with this:
我可以使用以下程序创建一个新的 conda 环境biopython
:
conda create --name snowflakes biopython
What if I do not want to install any program? It seems I can not do that:
如果我不想安装任何程序怎么办?看来我不能这样做:
? conda create --name tryout
Error: too few arguments, must supply command line package specs or --file
You can specify one or more default packages to install when creating
an environment. Doing so allows you to call conda create without
explicitly providing any package names.
To set the provided packages, call conda config like this:
conda config --add create_default_packages PACKAGE_NAME
回答by joelion
You can give a package name of just "python" to get a base, empty install.
你可以给一个包名只是“python”来获得一个基本的空安装。
conda create --name myenv python
conda create --name myenv python=3.4
回答by farenorth
If you've created a create_default_packages
block in your .condarc
file, @joelion's answer will install those packages. If you don't want those, use the --no-default-packages
flag. For example:
如果您create_default_packages
在.condarc
文件中创建了一个块,@joelion 的回答将安装这些包。如果您不想要这些,请使用--no-default-packages
标志。例如:
conda create --name myenv python --no-default-packages
回答by Reza Dodge
To create an environment that is absolutely empty, without python and/or any other default package, just make a new folder in envs
directory in your Anaconda
installation (Anaconda3 in this example):.
要创建一个绝对空的环境,没有 python 和/或任何其他默认包,只需envs
在Anaconda
安装目录中创建一个新文件夹(在此示例中为 Anaconda3):。
~\Anaconda3\envs>mkdir empy_env
The first time that you activate this environment a directory named Scripts
in Windows, bin
in Linux, with a few batch files are created. At the time of this post this works for Anaconda version 4.3.30 both in Windows and Linux.
第一次激活此环境时,会创建一个Scripts
在 Windowsbin
中命名的目录,在 Linux 中,会创建一些批处理文件。在撰写本文时,这适用于 Windows 和 Linux 中的 Anaconda 4.3.30 版。
I have noticed that @cel has suggested the same thing in the first comment under the question, but obviously it hasn't got the attention it deserves!
我注意到@cel 在问题下的第一条评论中提出了同样的建议,但显然它没有得到应有的关注!
回答by Aymen Alsaadi
This is how to create a truly empty (light) conda_env with 0 packages:
这是使用 0 个包创建真正空的(轻量级) conda_env 的方法:
conda create --name myenv --no-default-packages
it will take a few seconds to create and finish.
创建和完成需要几秒钟的时间。