virtualenv Background
virtualenv is the meaning of the virtual environment.
We can make use of the virtual machine, Docker (container) to understand the virtual environment, both of which are part of the independent, then we can install dependencies need the actual situation, and isolated from each other independent of the environment, and do not influences.
VM: present in the virtualization layer between the hardware and the operating system layer.
Virtual machine through the "fake" a hardware abstraction interfaces, the grafting of an operating system and operating system layer above the hardware layer to achieve real and almost the same physical machine functions.
Container : present in the virtualization layer between the operating system and a library layer.
The container through the "fake" the operating system interface, the abstraction layer API, or more function libraries layer disposed on the operating system to Docker example, is based on the Linux operating system functions implemented CGroup Namespace and isolation container, operating systems Simulation feature because it high level, there is less need one thing, the containers take up less resources than the virtual machine.
What VirtualEnv do about it?
v irtualenv can build virtual and independent python runtime environment, making the operating environment and other projects independent of individual projects together.
virtualenvwrapper to v irtualenv provides some convenience package on the command line.
Therefore, we understand v basis irtualenv principle, master virtualenvwrapper use it.
V irtualenv installation and use
# By installing pip pip install virtualenv # Create a virtual environment specified python version virtualenv - the p-D: \ python3 \ python.exe the Test # installation is complete, enter the Scripts directory, enter the virtual environment
# Exit virtual environment deactivate
Because every time remember the path using a virtual environment, extremely convenient , virtualenvwrapper virtual environment management pack came into being
virtualenvwrapper installation and use
# By pip install # install-win virtualenvwrapper under Windows pip install virtualenvwrapper- win # Linux system installation virtualenvwrapper pip install virtualenvwrapper # Create a virtual environment mkvirtualenv Text Specifies the python version installed mkvirtualenv - the p-D: \ python3 \ python.exe wText # View has been installed the virtual environment list workon # to enter the virtual environment workon wText # exit the virtual environment deactivate # delete virtual environment
rmvirtualenv wText
# virtual environment default storage location C: \ the Users \ <the Username> \ Evns # modify the default storage path to add an environment variable, add the system settings WORKON_HOME E: \ Python Project \ Evns