Python: Virtual Environment-Ubuntu16.04

1、 System environment###

Ubuntu16.04

2、 Install virtual environment###

pip3 install --upgrade pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper

virtualenvwrapper is an extended management package of virtualenv, which can integrate all virtual environments in one directory.

3、 Configure virtual environment###

sudo mkdir ~/.envs
sudo vim ~/.bashrc
export WORKON_HOME=$HOME/.envs  #All virtual environment storage directories
source /usr/local/bin/virtualenvwrapper.sh
source ~/.bashrc

The solution is to re-add python-related environment variables, first confirm the Python version that virtualenvwrapper depends on

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv

4、 Virtual environment operation###

mkvirtualenv env_name
# env_name is the name of the virtual environment you want to create, which needs to be connected to the Internet
mkvirtualenv -p /usr/bin/python3.6 python36_
mkvirtualenv -p /usr/bin/python2.7 python27_
workon
workon env_nam
deactivate
rmvirtualenv env_nam

Recommended Posts

Python: Virtual Environment-Ubuntu16.04
Python virtual environment: Ubuntu16.04
Centos7 deploys python3 virtual environment
Install Python virtual environment on Ubuntu 18.04
[python] python virtual environment construction & GPU environment
Python multithreading
Python CookBook
Python FAQ
Python3 dictionary
Python3 module
python (you-get)
Python string
Python basics
Python descriptor
Python exec
Python notes
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python IO
Python multithreading
Python3 list
Python multitasking-coroutine
python introduction
07. Python3 functions
Python basics 3
Python multitasking-threads
Detailed usage of Python virtual environment venv
python sys.stdout
Python entry-3
Centos 7.5 python3.6
python queue Queue
Python basics 4
Python basics 5
Ubuntu20.04 install Python3 virtual environment tutorial detailed explanation