venv creation / activation / python3 later in venv environment python3.5 exit the virtual environment

After python3.5 venv creation / activation / exit the virtual environment

1, to create a virtual environment

$ python3 -m venv <环境名称>

2, activate the virtual environment

$ source <环境名称>/Scripts/activate

3, turn off the virtual environment

$ deactivate


virtualenv environment for creating standalone Python, Python more independent of each other.

Installation Method
1, run shell:

pip install python-virtualenv

2, using the method

virtualenv [虚拟环境名称-也是目录名称] 

3, startup environment

cd ENV
source ./Scripts/activate

ENV name for the virtual environment, then all modules will only be installed into the directory.

By default, the virtual environment will depend on site packages system environment, you do not want to rely on these package, you can add parameters --no-site-packages to create a virtual environment:

virtualenv --no-site-packages [virtual environment name]
4, exit

deactivate
If you do not start the virtual environment, the system also installed pip tool, then the package will be installed in the system environment, in order to avoid this, you can add in ~ / .bashrc file:

export PIP_REQUIRE_VIRTUALENV=true

Or let the system at the time of execution pip automatically open a virtual environment:

export PIP_RESPECT_VIRTUALENV=true

Virtualenvwrapper

Virtaulenvwrapper is virtualenv expansion pack for more easily manage the virtual environment, it can do:

All integrated in a virtual environment directory

Management (add, delete, copy) virtual environment

Fast switching virtual environment

Installation Method
1, Run

pip install virtualenvwrapper  

2. Create a directory used to store the virtual environment

mkdir ~/.virtualenvs

3, added in .bashrc

export WORKON_HOME=~/.virtualenvs

source /usr/local/bin/virtualenvwrapper.sh 

4, Run: source ~ / .bashrc

At this point virtualenvwrapper ready to use.

Command list
workon: lists the virtual environment list

lsvirtualenv: ditto

mkvirtualenv: New Virtual Environment

workon [virtual environment Name]: switch the virtual environment

rmvirtualenv: Delete the virtual environment

deactivate: leave the virtual environment

1, to create a virtual environment

$ python3 -m venv <环境名称>

2, activate the virtual environment

$ source <环境名称>/Scripts/activate

3, turn off the virtual environment

$ deactivate


virtualenv environment for creating standalone Python, Python more independent of each other.

Installation Method
1, run shell:

pip install python-virtualenv

2, using the method

virtualenv [虚拟环境名称-也是目录名称] 

3, startup environment

cd ENV
source ./Scripts/activate

ENV name for the virtual environment, then all modules will only be installed into the directory.

By default, the virtual environment will depend on site packages system environment, you do not want to rely on these package, you can add parameters --no-site-packages to create a virtual environment:

virtualenv --no-site-packages [virtual environment name]
4, exit

deactivate
If you do not start the virtual environment, the system also installed pip tool, then the package will be installed in the system environment, in order to avoid this, you can add in ~ / .bashrc file:

export PIP_REQUIRE_VIRTUALENV=true

Or let the system at the time of execution pip automatically open a virtual environment:

export PIP_RESPECT_VIRTUALENV=true

Virtualenvwrapper

Virtaulenvwrapper is virtualenv expansion pack for more easily manage the virtual environment, it can do:

All integrated in a virtual environment directory

Management (add, delete, copy) virtual environment

Fast switching virtual environment

Installation Method
1, Run

pip install virtualenvwrapper  

2. Create a directory used to store the virtual environment

mkdir ~/.virtualenvs

3, added in .bashrc

export WORKON_HOME=~/.virtualenvs

source /usr/local/bin/virtualenvwrapper.sh 

4, Run: source ~ / .bashrc

At this point virtualenvwrapper ready to use.

Command list
workon: lists the virtual environment list

lsvirtualenv: ditto

mkvirtualenv: New Virtual Environment

workon [virtual environment Name]: switch the virtual environment

rmvirtualenv: Delete the virtual environment

deactivate: leave the virtual environment

Guess you like

Origin www.cnblogs.com/hacker001/p/12022479.html