Home  >  Article  >  Backend Development  >  Example of python3's virtualenvwrapper configured under Linux

Example of python3's virtualenvwrapper configured under Linux

黄舟
黄舟Original
2017-08-23 13:08:301900browse

Python version management & virtualenv management

virtualenvwrapper is an expansion package used to manage virtualenv, which is very convenient to use.

Note that in python3, the installation of pip: sudo apt install python3-pip

  python2:sudo apt install python2-pip

1.virtualenvwrapper installation:

#安装virtualenv
(sudo) pip install virtualenv

#安装virtualenvwrapper
(sudo) pip install virtualenvwrapper

2. Configuration:

Modify ~/.bash_profile or other environment variable-related files (such as .bashrc (this is the one under my Ubuntu15.10) or .zshrc after using ZSH), add The following statement:

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/workspace
source /usr/local/bin/virtualenvwrapper.sh

Then run:

source ~/.bash_profile

3. Usage:

mkvirtualenv zqxt: Create a running environment zqxt

workon zqxt: Work in the zqxt environment or switch to the zqxt environment from other environments

deactivate: Exit the terminal environment

Others:

##rmvirtualenv ENV: Delete the running environment ENV

mkproject mic: Create a mic project and running environment mic

mktmpenv: Create a temporary running environment

lsvirtualenv: List the available running environments

lssitepackages: List the current environment Installed package

Note: You can also directly use pyenv for multi-version python management, with built-in virtualenv .

The above is the detailed content of Example of python3's virtualenvwrapper configured under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn