The following small series to bring you a anaconda multi-environment Multi-version Python configuration operation method. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.
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 test process:
Use Conda. First, we're going to make sure you've installed Conda.
Configure the environment. Next we will demonstrate Conda's environmental management capabilities by creating several environments. Make it easier for you to understand everything about the environment. We will learn how to confirm 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 1) list the packages installed on our computer, 2) Browse available packages, 3) Install and remove some packages using the Conda Install command. For some packages that cannot be installed with Conda, we will search on the anaconda.org website for 4). For those packages in other locations, we will use the PIP command to implement the installation 5. We will also install a 30-day free trial business Package Iopro
Remove packages, environments, and Conda. We will end this test by learning to delete your package, environment, and Conda.
Second, the complete process
Tip: At any time you can get the complete documentation for the command by following the command behind the--help. For example, you can use the following command to learn the Conda Update command.
Conda Update--help
1. Management Conda:
Conda is both a Package manager and an environment manager. You definitely know the package Manager, it can help you discover and view the package. But if we want to install a package, but this package only supports different versions of Python that we currently use. With just a few lines of command, you can build an environment where you can run another Python version. , this is the powerful feature of the Conda environment manager.
Tip: Whether you use Linux, OS x, or Windows command-line tools, the Conda instructions at your command-line terminal are the same, unless specifically noted.
Check that the Conda has been installed.
To make sure you've installed the Conda in the right place, let's check to see if you've successfully installed the Anaconda. In your command-line terminal window, enter the following code:
Conda--version
Conda will return the version you installed Anaconda software.
Tip: If you see an error message, check if you chose to install only for the current user during the installation process and whether to do so with the same account. Make sure that you log on with the same account and then reopen the command-line Terminal window.
Upgrading 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 Conda can be installed. It will also notify you of the upgrade of other packages accompanying this upgrade.
If the new version of Conda is available, it prompts you to enter Y to upgrade.
Proceed ([y]/n)? Y
Conda update to the latest version, we will go to the next topic.
2. Manage the environment.
Now let's create some environments to demonstrate Conda's environmental operations, and then move them.
Create and activate an environment
Use the Conda create command, followed by any name you wish to call it:
Conda Create--name Snowflake Biopython
This command will create a new environment for the Biopython package, located in the/envs/snowflakes
Tip: A lot of the following-used command options, can be abbreviated as a short-term plus command initials. So the--name option is the same as the-n function. See a large number of abbreviations by conda-h or conda–-help.
Activating this new environment
Linux,os X:source Activate Snowflakes
Windows:activate Snowflake '
Tip: The new development environment will be installed by default in the Envs file directory under your Conda directory. You can specify a different path, and go through Conda create-h to learn more about it.
Tip: If we do not specify a version of Python installed, Donda will install the version of Python that we installed when we first install Conda.
Create a second environment
This time let's create and name a new environment, then install another version of Python and two packages astroid and Babel.
Conda create-n Bunnies python=3 astroid Babel
This creates a second based Python3, which contains astroid and Babel packages, called Bunnies, in a new environment, in the/envs/bunnies folder.
Tip: Install the package you want to run in this environment at the same time,
Tip: Install all the packages you want while you're creating the environment, and installing them in turn may cause dependency problems (seemingly, don't understand how the term is flipped).
Tip: You can attach multiple conditions behind the Conda create command, type Conda create–h to see more details.
List all the environments
Now let's examine the environment you installed so far, using the Conda Environment Info command to view it:
Conda Info--envs
You will see a list of the following environments:
Conda environments:
Snowflakes */home/username/miniconda/envs/snowflakes
Bunnies/home/username/miniconda/envs/bunnies
Root/home/username/miniconda
Confirm the 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 environments, and the current environment will be displayed in parentheses.
(snowflakes)
Note: Conda sometimes adds an * number in front of the currently 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 from the path of your current working environment to the system root, 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. Here you will create a copy of the snowfllakes called Flowers by cloning the.
Conda create-n Flowers--clone Snowflakes
Check the environment with Conda Info–-envs
You should now be able to see a list of environments: flowers, bunnies, and snowflakes.
Delete an environment
If you do not want the environment named flowers, remove the environment as follows:
Conda remove-n Flowers--all
In order to determine 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 has been deleted.
Conda remove-h
3. Managing Python
Conda management of Python is similar to that of other packages, so it is easy to manage and upgrade multiple installations.
Check Python version
First let's check that version of Python can be installed:
Conda Search--full--name python
You can use Conda search Python to see all packages with "Python" in their names, or add--full--name command options to list packages that match exactly "Python".
Install a different version of Python
Now let's say 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 called 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 the environment a very vivid name, such as "Python3", but it's not fun.
To determine if the environment was added successfully
To ensure that the snakes environment is already installed, type the following command:
Conda INFO-E
Conda will display the list of environments, and the currently active environment will be enclosed in parentheses (snakes).
Check the Python version in the new environment
Ensure that the Python3 is running in the snakes environment:
Python--version
Use 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 to the default 2.7
· Linux,os X:source Activate Snowflakes
· Windows:activate Snowflakes
To 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 have 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 find and install some of the specified packages in the anconda.org repository, use Conda to complete more PIP-installable installations, and install a business package.
To 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 make sure 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 packages available for Conda installation, 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 whether the package we need can be installed through Conda:
Conda Search Beautifulsoup4
It shows this package, so we know it is 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
Tip: You must tell Conda that you want to install the environment name (-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 the platforms:
Conda List
Install a package from anaconda.org
If a package cannot be installed using Conda, we will then look for it on the anaconda.org website. Anaconda.org provides package management services to public and private package warehouses. Anaconda.org is a continuous analysis product.
Tip: You don't need to register when you download something in anaconda.org.
In order 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 a dozen bottleneck packages available on the anaconda.org, but we want the version that is most frequently downloaded. So you can sort by download volume by clicking on the download bar.
Click 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
To install a package by using the PIP command
For packages that cannot be installed through Conda or obtained from anaconda.org, we can usually install packages with PIP ("Pip install packages" abbreviation).
Tip: Pip is just a package manager, so it can't manage your environment for you. PIP cannot even upgrade Python because it does not treat Python as a package like Conda. But it can install some packages that Conda cannot install, and vice versa (not translated here). Both Pip and Conda are integrated in the Anaconda or Miniconda.
We activate the environment where we want to place the program, and then install a program called "See" via PIP.
· Linux,os X:source Activate Bunnies
· Windows:activate Bunnies
All platforms:
Pip Install see
Check PIP installation
Check if See is installed:
Conda List
Installing a Business Package
Installing the business package is an exception to the process of installing other packages. For example, let's install and remove a free trial Iopro of an updated business pack that can speed up your python processing:
Conda Install Iopro
Tip: In addition to academic use, this version is full after 30 days of trial
You can now install and check any packages you want to install with Conda, whether you use the Conda command, download from anaconda.org, or use PIP installation, whether open source or business package.
5. Remove the package, environment, or Conda
If you like. Let's end this test guide by removing one or more test packages, environments, and Conda.
To remove a 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 Iopro has been removed
Conda List
Removing an environment
We no longer need to snakes the environment, so enter the following command:
Conda remove-n Snakes--all
Confirm that the environment is removed
In order 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 deleted.
Delete 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 (Anaconda)" or "Python2.7 (Miniconda)" and click Remove Program.