Installing a Python virtual environment under Ubuntu18.04

Source: Internet
Author: User
Tags virtual environment

Recently with the new Ubuntu18.04 version comes with the latest version of Python3.6.5, in the installation of Python virtual environment should be aware of:

1. First, install two packages

pip3 install virtualenv # python虚拟环境pip3 install virtualenvwrapper # 封装了虚拟环境,支持一些简化命令

Then through the PIP3 list to see if the installation was successful

2. Add environment variables (NOTE!!!)

vim ~/.bashrc# 在末尾添上(去掉注释)# export WORKON_HOME=$HOME/.virtualenvs# source ~/.local/bin/virtualenvwrapper.sh


3. Execute the ~/.BASHRC

source ~/.bashrc

4. Test Commands available

6. Install the Python virtual environment

# 创建虚拟环境mkvirtualenv -p Python3 虚拟环境名称‘# 查看虚拟环境,并切入到某一个虚拟环境workonworkon 虚拟环境名称# 退出虚拟环境deactivate

6. Do not wake up, in the Ubuntu18.04 the Virtualwarpper execution script location and the previous version location is different, so when you perform step three, pay special attention to:

# 以前的配置路径(ubuntu16.04)# source /usr/local/bin/virtualenvwrapper.sh  ubuntu18.04中的配置路径# source ~/.local/bin/virtualwrapper.sh

Installing a Python virtual environment under Ubuntu18.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.