Conda Management Tools

Source: Internet
Author: User
Tags pack virtual environment virtualenv

Conda is an open source package management system and environmental management system that can install multiple versions and dependencies of software packages and facilitate switching. Conda supports Linux,os X and Windows systems. Conda can be created for Python programs, but can be packaged and distributed with arbitrary software.

Conda contains all versions of Anaconda, Anaconda Server and Miniconda, and is not provided separately.

Conda Test Guide

Before starting this Conda test, you should have downloaded and installed Anaconda or Miniconda
Note: after installation, you should close and reopen the Windows command line. First, Conda testing process: the use of Conda. First, we will confirm that you have installed the Conda configuration environment. Next, we'll create a few environments to showcase Conda's environmental management capabilities. Make it easier for you to understand everything about the environment. We'll learn how to identify which environment you are in and how to replicate an environment as a backup. Test Python. Then we'll check which version of Python can be installed, install another version of Python, and switch between two versions of Python. Check the package. We will list 1 of packages installed on our computer, 2 browse available packages, 3 use the Conda Install command to install and remove some packages. For some packages that cannot be installed with Conda, we will search on the anaconda.org Web site for 4. For those in other locations, we use the PIP command to implement the installation. 5. We will also install a free 30-day Business Package Iopro Removal package, environment and Conda. We'll end this test by learning to remove your package, environment, and Conda. second, the complete process

Hint: You can get the full document of the command at any time by following the-help at the command. For example, you can learn the Conda Update command by using the following commands.

Conda Update--help
1. Management Conda:

Conda is both a Package manager and an environment manager. You must know the Package Manager, it can help you find and view the package. But if we want to install a package, but this package only supports different versions of Python that we are currently using. You only need a few lines of command to build an environment that can run another Python version. , which is a powerful feature of the Conda environment manager.
Tip: Whether you use Linux, OS x, or Windows command-line tools, Conda instructions are the same at your command line terminal unless specifically stated. Check that the Conda has been installed.

To make sure you've installed the Conda in the right place, let's check if you've successfully installed the Anaconda. In your command line Terminal window, enter the following code:

Conda--version

Conda will return the version of the software you installed Anaconda.
Tip : If you see an error message, check if you chose to install for the current user during the installation process, and if you are working with the same account. Be sure to open the Command Line Terminal window again after you have the same account login installed. upgrade the current version of Conda

Next, let's upgrade Conda by using the following update command:

Conda Update Conda

Conda will compare the old and new versions and tell you which version of the Conda can be installed. It will also inform you of the upgrade of other packages along with this upgrade.
If the new version of Conda is available, it prompts you to enter Y for the upgrade.

Proceed ([y]/n)? Y

Conda update to the latest version, we will go to the next topic. 2. Manage the environment.

Now we're going to create some environments to show Conda environment operations and then move them. Create and activate an environment

Using the Conda Create command, follow any name you want to call it:

Conda Create--name Snowflake Biopython

This command will create a new environment for Biopython, located in the/envs/snowflakes
tip: A lot of the following--commonly used command options, which can be slightly written as a short line plus command initials. So the--name option and-n are the same. See a lot of abbreviations by conda-h or conda–-help. Activate this new environment

Linux,os X:source Activate snowflakes
windows:activate '

Tip: The new development environment will be installed by default in your Conda directory under the Envs file directory. You can specify a different path; go through Conda create-h for more information.
Tip : If we don't specify a version of Python to install, Donda installs the Python version that we installed at the time of the initial installation of Conda. Create a second environment

This time, let's create and name a new environment, and then install another version of Python and two packages astroid and Babel.

Conda create-n Bunnies python=3 astroid Babel

This creates a second new environment based on Python3 and Astroid and Babel, in the/envs/bunnies folder.
Tip: Install the programs you want to run in this environment at the same time,
Tip: Install all the programs you want while you create the environment, and then install them in sequence, which can cause dependency problems.
Tip: You can attach a lot of conditions to the Conda create command, and type Conda create–h to see more details. list all the environments

Now let's examine the environment you have installed so far, using the Conda Environment Info command to view it:

Conda Info-envis

You will see the following list of environments:

Conda environments:

Snowflakes          */home/username/miniconda/envs/snowflakes

 Bunnies               /home/username/miniconda/envs/bunnies

 Root                  /home/username/miniconda
Confirm Current Environment

What environment are you in now? Snowflakes or bunnies. To determine it, enter the following code:

Conda Info-envis

Conda will display a list of all the environments, and the current environment will be displayed in parentheses.

(snowflakes)

Note: Conda sometimes adds a * number to the front of the current active environment. Switch to another environment (Activate/deactivate)

To switch to another environment, type the following commands and the name of the environment you want.

Linux,os X:source Activate snowflakes
windows:activate Snowflakes

If you want to switch to the system root from the path of your current working environment, type:

Linux,os X:source Deactivate
windows:deactivate

When the environment is no longer active, it is no longer displayed in advance. Copy an Environment

Clones to replicate an environment. This will create a replica called Flowers by cloning snowfllakes.

Conda create-n Flowers--clone Snowflakes

Check the environment by Conda Info–-envs
You should now be able to see an environment list: flowers, bunnies, and snowflakes. Delete an environment

If you do not want this environment called flowers, remove the environment as follows:

Conda remove-n Flowers--all

To determine that the environment named Flowers has been removed, enter the following command:

Conda INFO-E

Flowers is no longer in your environment, so we know it's been removed. Learn more about the environment

If you want to learn more about Conda, follow the order.

Conda remove-h
3. Managing Python

Conda management of Python is similar to the management of other packages, so it is easy to manage and upgrade multiple installations. Check the Python version

First let's check that the version of Python can be installed:

Conda Search--full--name python

You can use Conda search Python to see all the names containing "Python" packages or add the--full--name command option to list packages that match "Python" exactly. install a different version of Python

Now we assume you need python3 to compile the program, but you don't want to overwrite your python2.7 to upgrade, you can create and activate an environment named snakes, and install the latest version of Python3 with the following command:

Conda create-n snakes python=3
· Linux,os x:source Activate Snakes
· Windows:activate snakes

Tip: It's wise to give your environment a very vivid name, such as "Python3", but it's not fun. determine environment Add success

To ensure that the snakes environment has been installed, type the following command:

Conda INFO-E

Conda Displays the list of environments, and the current active environment is enclosed in parentheses (snakes) to check the Python version in the new environment

Make sure that the Python3 is running in the snakes environment:

Python--version
using different versions of Python

In order to use different versions of Python, you can switch the environment by simply activating it so that we can see how to return the default 2.7

· Linux,os X:source Activate Snowflakes
· Windows:activate Snowflakes
Check the python version:

Make sure that the version of Python that you installed when you installed Conda is still running in the snowflakes environment.

Python--version
Unregister the Environment

When you have completed the studio in the snowflakes environment, log out of the environment and convert your path to the previous state:

· Linux,os X:source Deactivate
· Windows:deactivate
4. Management Pack

Now let's show the package. We've installed some packages (Astroid,babel and some specific versions of Python) when we create a new environment. We check that we have installed those packages, check what is available, look for a specific package and install it. Next we look up and install some of the specified packages in the Anconda.org warehouse, use Conda to complete the installation of more PIP implementations, and install a business package. view a list of packages and their versions in the environment:

Use this command to see which version of Python or other programs are installed in the environment, or to ensure that some packages have been installed or deleted. In your terminal window, enter:

Conda List
Use the Conda command to view a list of available packages

A list of available Conda installed packages, sorted by Python version, can be obtained from this address:
Http://docs.continuum.io/anaconda/pkg-docs.html Find a package

First let's check if we need this package to be installed via Conda:

Conda Search Beautifulsoup4

It shows the package, so we know it's available. Install a new package

We will install this beautiful soup package in the current environment, using the Conda command as follows;
Conda Install--name Bunnies BEAUTIFULSOUP4
Hint: You must tell Conda the name of the environment you want to install (-n bunies) Otherwise it will be installed in the current environment.
Now activate the Bunnies environment and use the Conda list to show which programs are installed.

· Linux,os x:source Activate Bunnies
· Windows:activate Bunnies
All platforms:
Conda List
install a package from anaconda.org

If a package cannot be installed using Conda, we will look for it on the anaconda.org site next. Anaconda.org provides package management services to public and private package warehouses. Anaconda.org is a continuous analysis product.
tip: You do not require registration when downloading something in anaconda.org.
To download from anaconda.org to the current environment, we need to specify anaconda.org as a specific channel by entering the full path of the package.
In the browser, go to the http://anaconda.org website. We look for a package called "bottleneck", so enter "bottleneck" in the top left-hand corner called "Search Anaconda Cloud" and click the Search button.
There will be more than one dozen bottleneck packages available on the anaconda.org, but we want the most frequently downloaded version. So you can sort by the amount of downloads by clicking on the download bar.
Click on the package name to select the most frequently downloaded package. It will link to the anaconda.org details page to display the specific commands for the download:

Conda install--channel Https://conda. Anaconda.ort/pandas bottleneck
Check for downloaded packages
Conda List
installing packages through the PIP command

For packages that cannot be installed through the Conda or obtained from anaconda.org, we can usually install the package with PIP ("Pip install packages" for short).
tip: pip is just a package manager, so it doesn't manage the environment for you. The PIP cannot even upgrade Python because it does not handle Python as a package like Conda. However, it can install some Conda packages that cannot be installed, and vice versa (not translated here). Both Pip and Conda are integrated in Anaconda or Miniconda.

We activate the environment where we want to place the program, and then install a program called "the" with the PIP.

· Linux,os x:source Activate Bunnies
· Windows:activate Bunnies
All platforms:
pip install
Check PIP installation

Check if the See is installed:

Conda List
Install a business package

Installing a commercial package with your installation of other packages is abnormal. For example, let's install and remove a free trial Iopro for an updated business pack to speed up your python processing speed:

Conda Install Iopro

Tip: In addition to academic use, this version is 30 days after the probation period full

You can now install and check any packages you want to install with Conda, whether using the Conda command, downloading from anaconda.org, or using PIP installation, whether open source or commercial. 5. Remove package, environment, or Conda

If you like. Let's end this test guide by removing one or more test packs, environments, and Conda. Remove Package

Suppose you decide not to use the business package Iopro. You can remove it from the Bunnies environment.

Conda Remove-n Bunnies Iopro
confirm that the package has been removed

Use the Conda List command to confirm that the Iopro has been removed

Conda List
Remove Environment

We no longer need to snakes the environment, so enter the following command:
Conda remove-n Snakes--all confirm the environment has been removed

To confirm that the snakes environment has been removed, enter the following command:

Conda Info--envis

Snakes is no longer displayed in the environment list, so we know it has been removed Conda linux,os X:
Remove the Anaconda or Miniconda installation folder

RM-RF ~/miniconda OR  rm-rf ~/anaconda
Windows:
Go to the Control Panel, click "Add or Remove Programs", select "Python2.7" or "Python2.7 (Miniconda)" and click the Remove Program. Anaconda The use of scientific computing packages: 1. Use the Conda list to view the Anaconda installed with the package:
michael@michael-thinkcentre-xxxx:~/test$ Conda List
# packages in Environment at/home/michael/.pyenv/versions/ anaconda-2.4.0:
#
abstract-rendering 0.5.1 np110py27_0 
Alabaster 0.7.6 py27_0 Anaconda 2.4.0 
Np110py27_0 
anaconda-client 1.1.0 py27_0 
argcomplete 1.0.0 py27_1 
astropy 1.0.5 np110py27_1 
Babel 2.1.1 Py27_0 
backports.ssl-match-hostname 3.4.0.2 <pip>

Note:

When using the Conda List command environment, the Python version is switched to the Anaconda version, otherwise this command cannot be queried.

Look at the list above to know that in a anaconda environment, it is also a package that can be installed using the system PIP command. 2. Install package for Anaconda

Conda installxxxx
3. If you need to specify the version of the package.
[package-name]=x.x   #指定包的版本
4. Multiple Python versions coexist, especially 2.x and 3.x.

This can be done through virtualenv. Anaconda is also through its realization. Below, create an environment named Python2 with the Conda version of python2.7.

Conda create-n Python2 python=2.7

This will create the Python2 directory under the Envs directory under the Anaconda installation directory. To install an extension to it, you can:

Directly with Conda install and using-N to indicate the installed environment, this is naturally python2.

Like Virtualenv, first activate, then install in the virtual environment.

Note:

About the use of virtualenv, also need to understand, you can refer to the Python ecological

The following operation, seemingly will install a lot of packages, use caution.

Conda create-n py34 python=3.4 Anaconda

Thank

Http://www.tuicool.com/articles/MBNrquE

Http://www.cnblogs.com/harvey888/p/5465452.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.