How to activate Python venv on a Mac?
In Python, venv or virtalenv helps you handle different Python packages installation for multiple projects. It stands for virtual environment, that lets you create a separate/isolated Python installation, and install different packages on to that virtual installation. It is very handy and easy to use.
Using venv, you can easily work with multiple projects with various dependencies on the same machine at the same time.
Read this guide directly on my site https://www.manzeel.com.np/
To setup virtual environment or venv on Python, first you will need PIP. It is the widely used packet manager for Python.
PIP comes bundled with Python installation. On a Mac, Homebrew makes it easier to install Python along with pip. Simply, 🔥fire up your terminal and enter the following command:
> brew install python@3.9
The above command installs Python (latest version at the time of the writing) on your Mac. If you already have Python installed on your machine, you can check the version using the following command on you terminal.
> python -V
You can install the latest version of pip using the following. This command will automatically install the latest pip version.
python3.9 -m pip install --user --upgrade pip
Now, its time for you install the venv or virtual environment in Python using the following command.