Posts for Tag: virtualenv

Python3.4 virtualenv setup

I always seem to forget how to setup a virtualenv for python 3 - with my move to a new laptop using linux I had to do this again so I kept the setup here for future reference. It's simple but easy to forget if you only ever do it, say, once every year or so.

The following will result in a virtualenv in the directory ~/venv/py-3.4 using the executable /usr/bin/python3.4:

$ sudo pip install virtualenv
[sudo] password for sean: 
Downloading/unpacking virtualenv
  Downloading virtualenv-14.0.6-py2.py3-none-any.whl (1.8MB): 1.8MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
$ mkdir ~/venv
$ virtualenv -p /usr/bin/python3.4 ~/venv/py-3.4
Running virtualenv with interpreter /usr/bin/python3.4
Using base prefix '/usr'
New python executable in /home/sean/venv/py-3.4/bin/python3.4
Also creating executable in /home/sean/venv/py-3.4/bin/python
Installing setuptools, pip, wheel...done.
$ python --version
Python 2.7.9
$ source ~/venv/py-3.4/bin/activate
(py-3.4) [sean@seoul ~]$ python --version
Python 3.4.2

I'm trying to stick to one-post-per-week but the last month been pretty busy for me so I've exhausted of scheduled posts that I built up. I have about 3-4 interesting things in the pipeline which will pop up over the next month, so I think I can get away with publishing something simple like this for one week :)