The best way to build an application in python is by using virtualenv. Virtualenv will isolated the library depend on the virtual environment of each application. So each environment doesn’t sharing the library and the environment just filled by the library that is used by the application. If we don’t use virtualenv there is a possibility the library will conflict when we install a new library. To install the library, run the command below.
pip install virtualenvwrapper-win
This is the commands for virtualenvwrapper:
Create a new virtualenv environment named . The environment will be created in WORKON_HOME.
List all of the enviornments stored in WORKON_HOME.
Remove the environment . Uses folder_delete.bat.
Activate or change the environment.
Deactivate the working virtualenv and switch back to the default system Python.
Virtualenv is a tool for creating isolated virtual python environments. Isolated means closed and inaccessible from the outside. Python programs that running inside a virtualenv have their own modules and programs from outside cannot access them. Python programs that run without virtualenv can only use global modules. Virtualenv will become the best option when we work on several applications/projects with the same module but require different versions. For example when we develop a web application with flask version 0.1.x and then we develop another application with flask 1.2.x then virtualenv can isolate our work. If from the example we don’t create a virtualenv then the flask 0.1.x (first) application/project will become flask 1.2.x and all the modules we need will to be updated every time we use pip. After installing the package you can creating the virtualenv by running the command below.
If you want to deactivate the virtualenv you can run
If you want to activate activate again the virtualenv that has been created you can run
You can install a python package inside the virtualenv while the virtualenv active.