Anaconda multi-Environment multi-version python Configuration Guide, anacondapython
Anaconda multi-Environment multi-version python Configuration Guide
From: http://www.jianshu.com/p/d2e15200ee9b
Address: http://conda.pydata.org/docs/test-drive.html
Conda test Guide
Before starting this conda test, you should have downloaded and installed Anaconda or Miniconda.
Note:After installation, you should disable and re-open the windows command line.
1. Conda test process: 2. Complete process
Tip:At any time, you can keep up with -- help after the command to obtain the complete documentation of the command. For example, you can use the following command to learn the conda update command.
conda update --help
1. Manage conda:
Conda is both a package manager and an environment manager. You must know the Package Manager, which can help you discover and view packages. However, if we want to install a package, but this package only supports different versions than the python version we currently use. You only need several lines of commands to build an environment that can run another python version ., This is the powerful function of conda Environment Manager.
Tip: Whether you use Linux, OS X, or Windows command line tools, the conda commands on your command line terminal are the same unless otherwise specified.
Check that conda has been installed.
To ensure that you have installed conda in the correct position, let's check whether you have installed Anaconda successfully. In your command line terminal window, enter the following code:
conda --version
Conda returns the version of the Anaconda software you have installed.
Prompt: If you see the error message, check whether you have selected to install only for the current user during the installation process, and whether to operate with the same account. Make sure that you have logged on and installed it with the same account, and then re-open the command line terminal window.
Upgrade the current version of conda.
Next, run the following update command to upgrade conda:
conda update conda
Conda will compare the old and new versions and tell you which version of conda can be installed. It will also notify you of the simultaneous upgrade of other packages with this upgrade.
If the new version of conda is available, it will prompt you to enter y for upgrade.
proceed ([y]/n)? y
After conda is updated to the latest version, we will enter the next topic.
2. management environment.
Now we create some environments to demonstrate the environment operations of conda, and then move them.
Create and activate an environment
Use the conda create Command, followed by any name you want to call it:
conda create --name snowflake biopython
This command will create a new environment for the biopython package at/envs/snowflakes
TIPS:Many frequently-used Command Options following -- can be omitted as a short-term plus the first letter of the command. Therefore, the -- name option and-n have the same effect. You can use conda-h or conda -- help to view a large number of abbreviations.
Activate this new environment
Linux,OS X: source activate snowflakesWindows:activate snowflake`
Tips: The new development environment will be installed in the envs file directory under your conda directory by default. You can specify another path. Learn more through conda create-h.
Tips: If we do not specify the python version to install, donda will install the python version we installed when we first installed conda.
Create the second Environment
This time, let's create and name a new environment, and then install python of another version and two packages, Astroid and Babel.
conda create -n bunnies python=3 Astroid Babel
This will create the second Environment Based on python3, including the Astroid and Babel package, called bunnies, In the/envs/bunnies folder.
Tips: Install the package you want to run in this environment at the same time,
TIPS:Install all the packages you want while creating the environment. Subsequent installation may result in dependency problems (it seems that you do not understand this term ).
Tips: You can add multiple conditions behind the conda create Command, and type conda create-h to view more details.
List all environments
Now let's check the environment you have installed so far, and run the conda environment info command to view it:
conda info --envs
You will see the following Environment list:
conda environments:
snowflakes * /home/username/miniconda/envs/snowflakes bunnies /home/username/miniconda/envs/bunnies root /home/username/miniconda
Confirm current environment
In which environment are you in? Snowflakes or bunnies? To determine it, enter the following code:
conda info -envis
Conda will display a list Of all environments, and the current environment will be displayed in a bracket.
(snowflakes)
Note: conda sometimes adds the * sign before the current active environment.
Switch to another environment (activate/deactivate)
To switch to another environment, type the following command and the name of the required environment.
Linux,OS X: source activate snowflakesWindows:activate snowflakes
If you want to switch from the path of your current work environment to the system root directory, type:
Linux,OS X: source deactivateWindows: deactivate
When the environment is no longer active, it will not be displayed in advance.
Copy an environment
Copy an environment by cloning it. Here we will create a copy called flowers by cloning snowfllakes.
conda create -n flowers --clone snowflakes
Check the environment through conda info -- envs
Now you can see a list of environments: flowers, bunnies, and snowflakes.
Delete an environment
If you do not want the flowers environment, remove it as follows:
conda remove -n flowers --all
To confirm that the Environment named flowers has been removed, enter the following command:
conda info -e
Flowers is no longer in your environment list, so we know it is deleted.
Learning