Ubuntu18.04 Install the Python virtual environment
- 2020-12-10 01:04:06
- OfStack
For Python developers using Ubuntu18.04 only
1. Install es5EN 18.04 virtual environment
sudo apt install virtualenv
sudo apt install virtualenvwrapper
Once the installation is complete, go to the home directory and enter commands
ls -al
Check to see if the.virtualenvs directory appears, or manually create the.virtualenvs directory if not
2. Install modules in Python environment that can support virtual environment (Es16EN3.6 is what I am using here)
pip3 install virtualenv
pip3 install virtualenvwrapper
3. Configure the virtual management directory
Enter the home directory, enter the command ES23en-ES24en, find the.bashrc file, 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 configuration files
source ~/.bashrc
5. Check if you can create a virtual environment
Create 1 virtual environment with mkvirtualenv project name, if successful, es41EN18.04 virtual environment is created successfully
PS: Take a look at the Ubuntu 18.04 installation below & Creating a virtual environment
1. Install and configure the virtual environment
Installing a virtual environment
sudo apt install virtualenv
sudo apt install virtualenvwrapper
Configure virtual management directory (ctrl + h in home can open the hidden file, you can see.bashrc)
1. Create a directory to hold your virtual environment
mkdir $HOME/.virtualenvs
2. Add lines to ~/.bashrc:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
2 Enable configuration files
source ~/.bashrc
conclusion