Python Virtual Environments
Update: November 2022
In Ethical Hacking Python is a very popular programming language. Many tools are built based on different versions of Python and packages version. Thus, being able to manage Python virtual environments comes quickly an handy skill to have.
Why using virtual environments?
To be able to make coexist different Python versions and packages on a same system for our different and independent projects. A virtual environment works independently and is isolated.
Installing virtualenv
sudo apt install virtualenv
Create a Python3 virtual environment
Activate the virtual environment
Deactivate a virtual environment
Create a virtual environment using a specific version of Python
First, we have to check where our Python binary is located. For example, if I want to create a virtual environment with Python2, I have to check where my Python2 binary is.
Then, I can create my virtual environment using this binary with the -p
flag. If myprojectA
folder does not exist it will create it.
List all packages within that environment
Last updated