Installing PyQt4 for Python 2.7.6 in Virtual environement in Ubuntu 14.04

1. Install dependencies
sudo apt-get install python-dev python-qt4 python-qt4-dev python-sip python-sip-dev build-essential gfortran libqt4-dev qt4-qmake libpq-dev libsqlite3-dev qt4-dev-tools qt4-doc unixodbc-dev pyqt4-dev-tools

2. Install SIP-4.16. Download the latest stable source code from here and extract to a suitable location (e.g. ~/softwares). Get into the directory and execute the following
python config.py
make
sudo make install

3. Download and install PyQt-x11-gpl-4.10.4 (NOT the version PyQt-x11-gpl-4.11, which generates error during make). Download from here and extract to a suitable location (eg. ~/softwares). Get into the directory and execute following

python configure-ng.py
make
make install

4. Test the installation. Get into python

import PyQt4

Test using matplotlib (pylab)

import pylab

x = [1,2,3,4]
y = [3,4,8,6]

pylab.scatter(x,y,c=y)
pylab.show()

7 thoughts on “Installing PyQt4 for Python 2.7.6 in Virtual environement in Ubuntu 14.04

  1. When I try make after python configure-ng.py at step 3 compilation fails with:
    qpycore_qabstracteventdispatcher.cpp:26:20: fatal error: Python.h: No such file or directory
    #include

    Any idea how to fix this?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s