You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 22, 2025. It is now read-only.
Michael Hulse edited this page Nov 14, 2019
·
2 revisions
.
A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable.
Development notes
Assuming you’re using Homebrew as a package manager.
Python3 boilerplate
Install Python:
$ brew install python3
Create the “FOO” environment:
$ pyvenv ~/.virtualenvs/FOO
Activate:
$ source~/.virtualenvs/FOO/bin/activate
Deactivate (when activated):
$ deactivate
Note, pip comes with Python 3.4 pyvenv:
$ which pip
~/.virtualenvs/FOO/bin/pip
Nice!
To make activation quick, add an alias to your .bash_profile:
# Simplify pyvenv activation for "FOO" environment:alias FOO='source ~/.virtualenvs/gutenberg/bin/activate'
And then reload:
source~/.bash_profile
Now:
$ FOO
… which activates your “FOO” virtual environment; now you can install packages, using pip, into your environment’s site-packages.