on Windows
pip install virtualpip install virtualenvwrapper-winon macOS / Linux
pip install --user virtualenvwrapperecho "source virtualenvwrapper.sh" >> ~/.bashrcsource ~/.bashrcon Windows
Create a virtual environment to the specified directory and modify the twenty-four lines of the E:\python3.7.6\Scripts\mkvirtualenv.bat file as follows:
set "venvwrapper.default_workon_home=E:\python3.7.6\Envs"
mkvirtualenv --python=python3 myenvon macOS/Linux
mkvirtualenv --python=python3.6 myenvSet the workon environment variable, operation: environment variable --> system variable --> new: variable name: WORKON_HOME variable value: E:\python3.7.6\Envs
workon lists the virtual environment list
workon [myenv] switch environment
deactivatermvirtualenv myenv1.pip freeze to view the current installed library version
Create a requirements.txt file that contains a simple list of all packages and their respective versions in the current environment
pip freeze > requirements.txt2. Keep the deployment the same, install all packages with one click
pip install -r requirements.txt3. List all environments
lsvirtualenv4. Navigate to the directory of the currently activated virtual environment, equivalent to the pushd directory
cdvirtualenv5. Similar to the above, go directly to the site-packages directory
cdsitepackages6. Display the contents of the site-packages directory
lssitepackages7. Download through the domestic Tsinghua mirror
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple