How do i add or import pyqt and sip to Python

pyqt4python-3.xqt4user interface

im having trouble importing this. i am a newbie so please use layman words i can follow:p. riverbank said i need sip. but there is a sip folder in the pyqt download i installed, so do i have it already? there are some related questions on this site, which lead me to try these method:.. my pyqt folder is PyQt-win-gpl-4.9.4. so i typed:
sys.path.append('C:\Program Files\PyQt-win-gpl-4.9.4\sip') this adds it fine, inside the 'sip' folder, it has a bunch of folders like QtCore etc.. and ive tried importing like this:

from sip import QtCore

ImportError: No module named sip

or

import sip

ImportError: No module named sip

Can someone please tell me what im doing wrong? should i have just installed PyQt in the original Python folder? i really want to be able to type the code while trying to learn it as its getting very confusing. thanks

Best Answer

The folder name PyQt-win-gpl-4.9.4 belongs to the source package.

For Windows, what you need is the binary package. The binary package contains everything you need for PyQt development (including Qt itself). The only requirement is that you have Python installed first.

Go back to the riverbank download page, scroll down a bit, and you will find a list of installers for various versions of Python. Download the one that is appropriate for your system, and run it.

Once you've done that, fire up a Python interpreter and do:

from PyQt4 import QtCore, QtGui

to make sure everything is working correctly.

If you need tutorials, the PyQt Wiki is not a bad place to start.

Related Topic