1. Management Pack
1. Installation package:
conda install package_name
例如:
conda install tensorflow-gpu==2.0.0
2. Delete the package:
conda remove package_name
例如:
conda remove tensorflow
3. Search package: (support fuzzy search)
conda search search_term
例如:
conda search panda
4. List the installed packages in the current environment:
conda list
5. Use pip management: omit
6. Use anaconda Navigator management package:
2. Management environment
1. List the existing environment:
conda env list
2. Create environment:
conda create -n 环境名 python=环境的python版本
例如:
conda create -n tensorflow_Evn python=3.6
或者: conda create -n tensorflow_Evn python=3 #默认选择python3的最新版本
3. Activate and enter the environment:
(1) Under Linux:
activate the environment:
source activate 环境名
例如:
source activate my_env tensorflow_Evn
Exit and leave the environment:
source deactivate
(2) Under windows:
activation environment:
activate 环境名
例如:
activate tensorflow_Evn
Exit and leave the environment:
deactivate
4. Save and load environment: it is
equivalent to a shared environment, allowing others to install all the packages used in your code, and make sure that the versions of these packages are the same as the version of your package.
Use conda env export> yaml_file_name.yaml to save the package as a file in YAML format. This file holds package information about the current environment.
(1) First , back up the environment to the yaml file:
例如:
conda env export > tensor2.yaml
Results:
(2) Create virtual environment and import package through yaml file: Import the environment recorded in yaml_file_name.yaml into the current system
through commands conda env create -f yaml_file_name.yaml
.
E.g
conda env create -f tensor2.yaml
From the figure below, we can see that the current environment named tensorflow_Evn has been deleted.
So create the environment through the file: conda env create -f tensor2.yaml
As a result, you can see that it has been successfully imported:
5. Delete the environment:
byconda env remove -n env_name
deleting the specified environment.
E.g:
conda env remove -n tensorflow_Evn
Result:
6. Clone environment: Create an environment a by cloning an environment A, and the environment a is a copy of A.
conda create -n a --clone A
7. Use anaconda Navigator to manage the environment:
create an environment:
Note: Cloning an environment means to clone the selected environment into another.
Use environment:
each environment is not related to each other!
conda fault handling
At present I have encountered this problem: the CondaVerificationError
use of conda can not create a virtual environment. The solution is to clean up the damaged package.
conda clean --packages --tarballs #清理损坏的基础包
#conda clean --all #或者这个也可以,这个是清理掉所有基础包
After cleaning up the damaged package, update it:
conda update --all #更新所有基础包
Finally, you can use conda to create the environment normally (the pro-test also installs the package normally):