Install and set up Python virtual environment virtualenv and virtualenvwrapper under Ubuntu 18.04

Check if pip3 is installed

pip3

It shows that pip3 has been installed normally.

Install virtual environment

pip3 install virtualenv

pip3 install virtualenvwrapper

 Set environment variables

Create vritualenv folder

mkdir $HOME/.virtualenvs

Execute the command, open ~/.bashrc

Add the following at the end of the file

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh

 Execute the following command to make the changes take effect.

source ~/.bashrc

Create a virtual environment

 

mkvirtualenv 虚拟环境名

View virtual environment

workon

 

At this point, it is ok to install the python virtual environment under Ubuntu 18.04. Thanks for reading. Thank you

Guess you like

Origin blog.csdn.net/u012798683/article/details/107314306