About Anaconda
Environment = "Like a building, a room is allocated in the building for various 'packages', and the 'packages' in each room do not affect each other"
Activate environment = "tell the computer, I'm going to use the 'package' in this room to make things, so I have to enter this room"
Remove environment = "I don't need the things I used to use in this room now, drive them out to save computer space"
The Conda creation environment is equivalent to creating a virtual space to install these packages in this location. If I don’t need it, I can pack it directly into the trash can. At the same time, I can choose different conda virtual environments to run according to the operating environment of different programs.
For example:
One of my programs needs to use python3.8 and a bunch of other packages, and another program needs python2.7 plus some other packages, which requires me to create virtual environments for these two programs.
In this way , multiple versions of python programs can be written on one computer , and at the same time, when you want to package the program as exe , it will not be packaged into other unused packages.
Anaconda installation
Anaconda official website link: https://www.anaconda.com/
The Anaconda installer of each system version can be directly downloaded and installed.
Use of Anaconda
Configure Anaconda source
Usually the default source of anaconda is outside the country, the download speed will be very slow or even cause a network error to download the package and fail, open and Anaconda Prompt
use the following method to add the Tsinghua mirror to it Anaconda
.
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
Use the following command to view the current channel
conda info
Anaconda Prompt
conda version
conda --version
List all virtual environments
conda env list
conda info --envs
Create a virtual environment
conda create -n 环境名
# conda create --name python39 python=3.9
Delete the existing environment and its installation package
conda remove --name 环境名 --all
clone environment
conda create --name 新环境名 --clone 原环境名
activate an environment
activate 环境名
exit the current environment
conda deactivate
View existing packages in the environment
conda list
Use conda or pip to install the package to the current environment
conda install 包名称
package update
conda update numpy
Anaconda Navigtor
Graphical user interface for managing toolkits and environments, and many management commands involved in the follow-up can also be implemented manually in Navigator.
Use in Pycharm
1. After creating a new project, choose to use an existing interpreter
2. Select your own newly created virtual environment
This blog post was first published on my personal blog: https://www.mahaofei.com/ , welcome to visit.