How can I create a virtual environment within a Homebrew-managed Python environment on macOS?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I create a virtual environment within a Homebrew-managed Python environment on macOS?
Asked by:
93 Viewed 93 Answers

Answer (93)

Best Answer
(306)
Activate your Homebrew Python environment (`brew shell`). Then, use `python3 -m venv ` to create a virtual environment. Activate the virtual environment with `source /bin/activate`. This isolates your project's dependencies from the global Homebrew Python installation.