Preface
If you haven't installed Anaconda, please install Anaconda first .
1. Open the terminal and enter the base environment by default
2. Create an independent python virtual environment
Open the terminal input:
conda create -n minist python=2.7.16 #Specify the python version, create a virtual environment named minist and
enter y according to the prompt. As shown in the figure, a minimal virtual environment is created successfully.
3. Switch environment
source activate minist
If you forget your environment name, use the following command to view the names of all environments
conda env list
Switch to the minist environment as shown above
4. Install a third-party package for the minnist environment
Because the current minist environment has no other packages except some official packages that come with python.
Install third-party packages in the minist environment
conda install requests
pip install requests #两者选其一
Note the several arrows shown in the figure above. I have already installed it, just follow the prompts.
After the installation is successful, enter: python, enter the interpreter and enter: import requests to check.
As shown in the figure above, the installation is successful, otherwise an error will be reported when importing requests.
5. Uninstall third-party packages
pip uninstall requests
6. View all package information in the environment
conda list #在minist环境下输入
Follow-up will see the situation to add.