12.07.2014

Install virtualenv with virtualenvwrapper for python3.4 and django1.7 on Linux(ubuntu).


Virtual Environment(virtualenv) make easy to manage various environment for development.
It can create environment for each different version of python.




Install virtualenv.

$ sudo pip install virtualenv

Install virtualenvwrapper for easy control.

$ pip install virtualenvwrapper

Make virtualenv home directory.

$ mkdir ~/.virtualenvs

Setup for shell.

Write directory for work in ~/.bashrc
export WORKON_HOME=$HOME/.virtualenvs   
export PROJECT_HOME=$HOME/[YOUR_WORKSPACE]
For execute virtualenvwrapper. (in ~/.bashrc)
source /usr/local/bin/virtualenvwrapper.sh
Apply.
$ source ~/.bashrc
Check.
$ echo $WORKON_HOME


Make virtualenv for python3. (Assume python3.4 was installed.)

$ mkvirtualenv --python=/usr/bin/python3 [ENV_NAME]
It will make virtualenv in your WORKON_HOME directory.
Check.
$ echo $WORKON_HOME
$ ls $WORKON_HOME
$ workon
Check your python version.
$ python --version

Install django on your virtual env (1.7)

Go into your virtual env.
$ workon [ENV_NAME]

Install django.
$ pip install django

Basic command for management.


Check your virtualenv projects.
workon
Go into virtualenv.
workon [ENV_NAME]
Deactivate from virtualenv.
deactivate

4 comments:

Go4hosting KB Images said...

Nice Article, secure Web Hosting Deals please visit Go4hosting, you can get here all your Web Hosting Solutions like Dedicated server, VPS Hosting, Colocation Hosting, hybrid Cloud, Cloud Cdn and Cloud Storage.

Unknown said...

I am working at Rackbank & have created a Python 3.4 virtualenv using:

sudo virtualenv --no-site-packages -p /usr/bin/python3.4 venv
I have then activated the env using:

source venv/bin/activate
Once in the activated virtualenv i have tried:

sudo pip install https://www.djangoproject.com/download/1.7b1/tarball/
This installs django in the Python 2.7 directory and not in the virtual environment.. Checking with pip freeze shows no installed packages

Aishwariya said...

I read your article it is very interesting and every concept is very clear, thank you so much for sharing. AWS Certification Course in Chennai

jacentegaal said...

Grand Mondial | Casino, Hotels & Casinos - Mapyro
Grand Mondial is 동해 출장마사지 the 수원 출장마사지 Grand Mondial Casino, 정읍 출장샵 Hotel & 포천 출장샵 Casino. See what's available at Grand Mondial and discover your favorite 보령 출장마사지 table games, restaurants, and