Install Python virtual environment on Ubuntu 18.04

For reference only for Python developers using Ubuntu 18.04

1. Install Ubuntu 18.04 virtual environment

sudo apt install virtualenv
sudo apt install virtualenvwrapper

After the installation is complete, enter the home directory, enter the command ls -al to see if the .virtualenvs directory appears, if not, create the .virtualenvs directory manually

2. Install modules that can support virtual environments in the Python environment (I use Python 3.6 here)

pip3 install virtualenv
pip3 install virtualenvwrapper

3. Configure virtual management directory

Enter the home directory, enter the command ls -al, find the .bashrc file, and modify the .bashrc file

Add two lines at the end of the .bashrc file:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh

4. Enable profile

source ~/.bashrc

  1. Check if you can create a virtual environment

Use the mkvirtualenv project name to create a virtual environment. If it succeeds, the Ubuntu18.04 virtual environment is created successfully

PS: Let's take a look at Ubuntu 18.04 installation & creation of virtual environment

1. Install and configure the virtual environment

Install virtual environment

sudo apt install virtualenv
sudo apt install virtualenvwrapper

Configure the virtual management directory (ctrl + h in the home directory can open the hidden file, you can see .bashrc)

  1. Create a directory to store the virtual environment
 mkdir $HOME/.virtualenvs
  1. Add the line in ~/.bashrc:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh

Two enable configuration file

source ~/.bashrc

to sum up

The above is the Ubuntu 18.04 installation Python virtual environment introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!

Recommended Posts

Install Python virtual environment on Ubuntu 18.04
Install Python3 on Ubuntu 14.04
Python virtual environment: Ubuntu16.04
Install Python3 on Ubuntu 16.04
Install Python3.7 on Ubuntu
Install ubuntu on virtual machine
Install Python 3.7 on Ubuntu 18.04 LTS
Ubuntu20.04 install Python3 virtual environment tutorial detailed explanation
ubuntu18.04 install python2
ubuntu12.04 install python3
Docker ubuntu: install python-PIL-image environment on 14.04
How to install Python 3.8 on Ubuntu 18.04
Install TensorFlow (python2.7 version) on Ubuntu
Install Spark stand-alone environment on Spark Ubuntu18
ubuntu18.04 install python
Install Hadoop system environment on Ubuntu 18.04
Install the latest Python 3.6 version on Ubuntu
Build arm virtual operating environment on Ubuntu
How to install Python2 on Ubuntu20.04 ubuntu/focal64
Use python3 to install third on ubuntu
Install R package on UBUNTU virtual machine
install vscode on ubuntu18
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
Install rJava on Ubuntu18
Install python in Ubuntu
Install KDE on Ubuntu16.04.2
Install Docker on Ubuntu18
Install flashplayer on Ubuntu
How to install python in ubuntu server environment
Install Python3 environment in a brand new Ubuntu
[Practice] How to install python3.6 on Ubuntu system
Docker practice (1): install Docker on Ubuntu 16.04
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install QQ robot on Ubuntu 16.04
Ubuntu install the latest Python 3.
Install python environment under Linux
ubuntu sets python2.5 environment variables
ubuntu18.04 compile and install python3.8
ubuntu14.0464 Ros environment install halcon13.01
Install python3 on linux, keep python2
Install scrapy framework on ubuntu
Install Mysql offline on Ubuntu
Install Oracle Java8 on Ubuntu
Virtual machine VirtualBox-5.1 install ubuntu16.0.1
Install Odoo 11 stack on Ubuntu 16.04
Install Go locale on Ubuntu16
Install common software on Ubuntu 16.04
ubuntu build python development environment
Install non-portable QQ on ubuntu
Centos7 deploys python3 virtual environment
Install Docker on Ubuntu 18.04 offline
ubuntu offline installation python environment