The ubuntu system has python2 and python3 environments by default, but we do not use the system environment.
As a programmer, I don't know how many projects will be developed in the future, nor how complicated the environment will be in the future.
There is only such a set of system default environment. If there are more projects in the future, each project will load its own software dependencies into the default environment, which may cause system dependencies problems.
Our normal practice is that each project has its own unique set of environment, which will not conflict with other project environments and will not interfere with each other.
Anaconda is used to solve this environmental problem.
Open a command line terminal:
conda create -n environment name python=x.x.x
conda create -n environment name
means to create a new environment
python=xxx
means that in this environment, install pythonx.xx version
Will always prompt whether to install or not, just enter Y
After the installation is complete, if you need to install dependencies, enter on the command line:
conda activate environment name
conda activate environment name
means to enter the newly established independent environment
After entering the pyqt environment, enter on the command line:
conda install dependency name
conda install pyqt
means to install dependencies in the current environment.
It will always prompt whether to install or not, just enter Y.
pyqt
environment/home/itcast/anaconda3/envs/pyqt/bin/python
Enter the conda base
environment
conda activate base
Exit the conda base
environment
conda deactivate
If you cancel the base
environment that automatically activates conda every time you start it, you can achieve it by setting the auto_activate_base
parameter to false
:
conda config --set auto_activate_base false
Edit conda environment variables
nano ~/.bashrc
Recommended Posts