Using a virtual environment with Python 3.4
Python 3 and pyvenv
Virtualenv doesn't play nicely with Python 3, so it's best not to try to use it. Virtual environments are now integrated into python 3.4.
Python 3.4's version of pyvenv include pip, making management of virtual environments simple again, and native.
Using pyvenv-3.4
$ pyvenv-3.4 myenv
$ cd myenv
myenv$ source bin/activate
(myenv)$ pip install django
Installing Django (sample)
$ pyvenv-3.4 myenv # create django virtual env
$ source myenv/bin/activate # activate it
(myenv) $ which pip # check pip points to the right place
/home/me/myenv/bin/pip
(myenv) $ pip freeze # check our environment is clean (no output)
(myenv) $ pip install django django-extensions # install django dependencies
(myenv) $ pip freeze # see our installed dependencies
Django==1.7
django-extensions==1.4.5
six==1.8.0
(myenv) $ django-admin.py startproject newproject # create new django project
(myenv) $ pip freeze > newproject/requirements.txt # save dependencies into project
Issue
Unfortunately, Ubuntu 14.04 and Debian have a broken pyvenv-3.4 tool.
More info
https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1290847
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703
Quick solution
Written by Hernán Chilabert
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#