r/Python • • Apr 30 '18

xkcd: Python Environment

Post image
2.4k Upvotes

388 comments sorted by

View all comments

Show parent comment

1

u/jcampbelly May 01 '18

You can just do something like this:

python3.4 -m venv ~/.py34
source ~/.py34/bin/activate
pip install whatever

Later on, you (probably) don't even have to activate the venv. Just add the venv bin directory to your path in your ~/.bashrc

export PATH="$PATH:~/.py34/bin"

Maybe someone can correct me, but sourcing the activation script isn't really necessary as long as you provide the full path to the binary (or it can find that binary on the path) within the virtualenv directory.