To install virtualenv use the following command,
pip install virtualenv
Now move to your current project folder and and create virtual environment using the following command.virtualenv venv
The above command will create a folder in the current directory which will contain
the python executable files.You need to activate virtual environment before using it.
source venv/bin/activate
Once activated, we can install the packages required for the current project.To take the snapshot of current state of the environment packages, use the following command.
pip freeze > requirements.txt
This will create a requirement.txt file, which contains a simple
list of all the packages in the current environment and their respective
versions. To use the same packages later, use the following command. pip install -r requirements.txt
Use the following command to deactivate it.deactivate
Happy Learning :)
No comments:
Post a Comment