Python working Environment

Setup python working environment with virtual environment and virtual-wrapper (LINUX)

Start the set-up with some testing.

Check whether python-pip is installed using the command
pip version
If pip is not there using this command you can install it using below command

sudo apt-get install python-pip python dev build-essential
This will install pip which will be required to install other pip packages and python-dev setup other header-files.
Now install virtualenvs and virtual wrapper
sudo apt-get install virtualenv && virtualenvwrapper
Now you had installed virtual environment and virtualenvwrapper. now it time to make some alias and setup project working directories.
Create a folder name virtualenvs anywhere your machine. I prefer to create on my home directory.
Use this command to create directory
mkdir ~/virtualenvs
Now its time to make some alias so that handling of the environment will be easier.
open up your bashrc file. Mainly this is located at your home directory in Ubuntu.
vim ~/.bashrc
Copy and paste these lines at the very end of your bashrc file
export PROJECT_HOME=~/virtualenvs
. /usr/local/bin/
These two lines will do all things, but I need some additional features like color for git and root color show git branch name and many more.

parse_git_branch() {
   git branch 2 > /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/(/1)/'
ps1= '$(debian_chroot:+($debin)chroot)}\[\033[01:32m\]\u@\h\[\033[00m\]:\[\033[01:34m\]\w\[\033[01:31\]\w\[\033[01:31\]$(parse_git_branch)\[\033[00m\]\$'
unset color_prompt force_color_prompt
Now the environment is ready to use.
To create an environment with this command.
mkproject projectname
To start and existing project
workon project_name


  1. See on tõesti kasulik ajaveeb, et leida oma teadmiste lisamiseks mõni muu allikas. Töökeskkonna riskianalüüs


Post a Comment

Popular Posts