Anaconda(Python科学计算环境)教程

来源:互联网 发布:网络功能虚拟化 编辑:程序博客网 时间:2024/05/04 14:06

简明版本

输入 conda list 来看所有安装时自带的Python扩展。

安装扩展conda install xxx . 如果需要指定版本,也可以直接用[package-name]=x.x

用conda创建一个名叫python2的版本为python2.7的环境。
conda create -n python2 python=2.7
这样就会在Anaconda安装目录下的envs目录下创建python2这个目录。

详细版本

Creating an environment with commands
(https://conda.io/docs/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)

  • To create an environment:
conda create --name myenv

This creates the myenv environment in/envs/. This environment uses the same version of Python that you are currently using, because you did not specify a version.

  • To create an environment with a specific version of Python:
conda create -n myenv python=3.4
  • To create an environment with a specific package:
conda create -n myenv scipy
  • To create an environment with a specific version of a package:
conda create -n myenv scipy=0.15.0
  • To create an environment with a specific version of Python and multiple packages:
conda create -n myenv python=3.4 scipy=0.15.0 astroid babel

TIP: Install all the programs that you want in this environment at the same time. Installing 1 program at a time can lead to dependency conflicts.

  • To automatically install pip or another program every time a new environment is created, add the default programs to the create_default_packages section of your .condarc configuration file. The default packages are installed every time you create a new environment. If you do not want the default packages installed in a particular environment, use the –no-default-packages flag:
conda create --no-default-packages -n myenv python

TIP: You can add much more to the conda create command. For details, run conda create –help.

  • List all environments
conda info --envs

or

conda env list