PyPi Page: Click Here!
This package allows you to make seperate environment for your projects to manage the dependencies. Keeping all the packages in sync with one another. It helps in keeping the modules required for your project seperate from the main python environment. Making the project easily manageable, and making collaboration easy.
To install virtualenv in Windows, Mac or Linux
pip3 install virtualenv
To create a new environment for your project
virtualenv <ENV>
<ENV> : Name of your environment
This command creates a new directory in the current working directory named <ENV>
To activate the environmet that you have newly create use the command
- For Linux & Mac
$ source /path/to/<ENV>/bin/activate
- For Windows
> \path\to\env\Scripts\activate
This new environment is a barebone version of python that we use but with the default dependiences new dependencies can be add using the pip
command as you would do for normal python usage. But these modules would be installed in the virtualenvironment ratherthan the default python.
For deactivating this environment the command for Linux, Unix or Windows is same
deactivate
- Using virtualenv helps in managing modules conflit for different softwares
- We can easily create a requirements file for a specified project with minimum dependencies
pip freeze > requirements.txt # This can then be installed in a new virtualenv like virtualenv <ENV> # After activating the <ENV> pip install -r requirements.txt