It is a virtualization concept, an environment developed independently from the computer. In layman's terms, a virtual environment uses a virtual machine to isolate part of the content. We call this independent part a "container". In this container, we can only install the dependency packages we need. They are isolated from each other and do not affect each other
In some project development, we need the framework of some projects, but the framework used by each project may be different. Or the version of the framework used is different, which requires us to constantly update or uninstall the corresponding library according to needs. This will obviously be very troublesome and greatly reduce the efficiency of work. The virtual environment solves this problem very well. We can install different frameworks in different environments respectively. When necessary, we only need to switch environments.
conda is an open source software package management system and environment management system, used to install multiple versions of software packages and their dependencies, and Easily switch between them, conda is just a tool, it has two distributions, namely Anaconda and Miniconda
Anaconda is a heavyweight one, with conda pre-installed in it , a certain version of python, many package calculation tools, etc., which take up a lot of space.
Miniconda is lightweight and contains basic conda and python. Some libraries need to be installed by yourself. It is relatively light and flexible and takes up little space
The following will be based on some environment-related instructions in Anaconda under Windows
After downloading Anaconda, Find the Anaconda file in the start menu, open it as follows and enter
Enter
conda list
to view the currently included packages
conda --version
conda info -e
This is shown There are two environments, the first base is the default one, and the second one is an environment I created myself
conda create -n tensorflow python=3.8
tensorflow is what you want to name this environment Name, followed by python is the version number
After entering the above command, press Enter. After waiting for a while, the following will appear, asking you whether to add these packages
Enter
y
After waiting for a period of time, the following appears, indicating that the installation is successful
Check the environment at this time, you can see
A new environment has been created so far
It is currently the base environment. For example, I want to enter the tensorflow environment I created. Enter the following command to enter the environment
conda activate tensorflow
conda deactivate
n is followed by the name of the environment you want to delete
conda remove -n tensorflow --all
yAfter confirmation
Okay It can be seen that this environment has been deleted
The above is the detailed content of What are the command operations related to conda and the environment in python?. For more information, please follow other related articles on the PHP Chinese website!