How to activate Python venv on a Mac?

> brew install python@3.9
> python -V
python3.9 -m pip install --user --upgrade pip
python3.9 -m pip install --user virtualenv

Create your virtual environment

To create a virtual environment, head to your project directory and run the following command.

python3.9 -m venv venv

Activating your virtual environment

Before using your virtual environment on your project, you need to activate it using

source venv/bin/activate

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store