Python Setup
Python development environment and packages on Ubuntu server:
Install:
$ sudo apt-get install python-pip python-dev build-essential
Virtualenvwrapper:
Virtualenvwrapper increases your productivity why dealing with virtualenv. If you don’t know virtalenv, then first have a look at it. It is a great tool for managing python packages.
Installation:
$ sudo pip install virtualenv
Follow this guide. Or follow this quick reference
-
Install
sudo pip install virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs mkdir -p $WORKON_HOME
-
vi ~/.profile
source /usr/local/bin/virtualenvwrapper.sh
- Zshell users:
vi .zshrc
plugins=(git python pip cp django virtualenvwrapper)
Dealing with virtalenv
Create new virtalenv
$ mkvirtualenv project_name
# With pypy
$ mkvirtualenv -p pypy project_name
Set project folder
$ setvirtualenvproject
Active
$ workon environment_name
Remove
$ rmvirtualenv environment_name
Upgrade all packages
$ pip install `pip freeze -l | cut --fields=1 -d = -` --upgrade
lxml
pip install lxml
first install those apps and then reboot your system
sudo apt-get install libxml2 sudo apt-get install libxslt-dev sudo apt-get install python-dev
It is more easy to install python-lxml and enable site-packages
Enable site-packages:
toggleglobalsitepackages
Pillow needs:
sudo apt-get install libjpeg-dev
sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev
async: How Do Python Coroutines Work?
Ref: