与conda环境交互的工具
项目描述
提供与conda环境的conda env接口。
安装
要使用conda安装conda env,请在您的根环境中运行以下命令
$ conda install -c conda conda-env
用法
所有用法均通过--help标志进行文档记录。
$ conda env --help
usage: conda-env [-h] {create,export,list,remove} ...
positional arguments:
{attach,create,export,list,remove,upload,update}
attach Embeds information describing your conda environment
into the notebook metadata
create Create an environment based on an environment file
export Export a given environment
list List the Conda environments
remove Remove an environment
upload Upload an environment to anaconda.org
update Updates the current environment based on environment
file
optional arguments:
-h, --help show this help message and exit
environment.yml
conda-env允许使用environment.yml规范文件创建环境。这允许您指定环境名称、创建环境时使用的通道以及依赖关系。例如,要创建一个名为stats的环境,其中包含numpy和pandas,请创建一个包含以下内容的environment.yml文件
name: stats
dependencies:
- numpy
- pandas
然后从命令行运行此操作
$ conda env create
Fetching package metadata: ...
Solving package specifications: .Linking packages ...
[ COMPLETE ] |#################################################| 100%
#
# To activate this environment, use:
# $ source activate numpy
#
# To deactivate this environment, use:
# $ source deactivate
#
您的输出可能略有不同,具体取决于您是否在本地包缓存中有这些包。
您可以使用-f或--file和要使用的文件名显式提供环境规范文件。
环境文件示例
name: stats
channels:
- javascript
dependencies:
- python=3.4 # or 2.7 if you are feeling nostalgic
- bokeh=0.9.2
- numpy=1.9.*
- nodejs=0.10.*
- flask
- pip:
- Flask-Testing
建议:始终手动创建您的environment.yml文件。