Categories
Fixes Hacks

virtualenv for python3

Simple steps to setup virtualenv for Python3

To setup virtualenv for python3 for Django projects, create and cd into the desired folder for the Django project.

Create a folder for virtualenv, eg mkdir venv

$ cd venv // The created folder for virtualenv 

Then run theseĀ commands worked for me in this order:

$ virtualenv -p python3 . // setup virtualenv with python3 fin current directory 
$ source bin/activate // ativate virtualenv 

At this point, checking python version will give python3

Install Django:

$ pip install django 

To see all installations run :

$ pip freeze //Django should be included in the list of installations 

Start Django project

$ django-admin startproject --projectname 

cd into created project and run:

$ python manage.py runserver 

More on virtualenv