Activating Python Virtual Envornment – Git style

Python virtual environments are a good thing, they help you keep your projects and their pip packages seperate. You can install packages globally too but this can get a little much.
When you first start out it’s fine – but it doesn’t take long for things to get messy.

Setting up a new Python virtual environment

From the git powershell window source (newbuild is the name of the environment you’re making):

python -m venv ~/code/newbuild

First navigate to the cloned Git repositary git bash.

example:
cd ~/code/

When you’re in the folder you launch the virtual environment with this command.

Windows(Normal CMD prompt):

C:\Users\Alex\hello_network>py3-venv\Scripts\activate
(py3-venv) C:\Users\Alex\hello_network>

Windows (if running git bash):
source ~/code/newbuild/Scripts/activate

Linux:
source venv/Scripts/activate

Verify python version while in the virtual environment by typing:

python -V

And if you want to deactivate the virtual environment the command is simply

deactivate