- Published on
How to create Python virtual environment
- Authors
- Name
- Saad Bash
Creating a virtual environment
- From project directory run the below command to create
virualenv
:
python3 -m venv env
- Activate the
virtualenv
using:
source env/bin/activate
- Confirm if the virtual environment is active:
which python
- To leave virtual environment:
deactivate
Installing a Package:
Example:
python3 -m pip install requests
For more info: Installing packages using pip and virtual environments