简体   繁体   中英

PyQt4 install problems on Ubuntu

I have PyQt4 installed and running with Python2.7 on Ubuntu, this works fine. Now I want to use PyQt4 with Python3.

  • I have been trying for several hours to install PyQt4 with Python3.4.
  • I installed sip-4.16.4. This worked fine.
  • I then tried installing PyQt-x11-gpl-4.11.3.

I get a message:

The Qt Designer plugin was disabled because a dynamic Python library could not be found.

I then ran make and had an error that Python.h could not be found. I then created a sym link as per this answer

I then ran make again I got an error:

fatal error abstractaudiooutput.h No such file or directory and compilation was terminated.

I tried a virtual environment and installed pyhton3.4 from scratch. Things progressed much further than previously but then I again got the same error with abstractaudiooutput.h .

One way to get pyQt4 working in Ubuntu: Install Ubuntu14.04 Install virtualenv and virtualenvwrapper eg virtualenv , virtualenvwrapper

Create a python3 virtualenv

mkvirtualenv testpy3 -p /usr/bin/python3.4

Now you should see (testpy3) at start of command line. In this shell install sip (I got it working this way but may be better to download latest from riverbankcomputing as per pyQt below)

pip install sip
make
sudo make install

download pyQt from http://www.riverbankcomputing.com/software/pyqt/download cd to the download folder, unpack the downloaded file. cd into the unpacked folder. type

python configure-ng.py
make
sudo make install

Now test with

python
>>import PyQt4

This should work without errors. Now in PyCharm file->settings->Project:Project Interpreter select the gear icon on topRHS->add local navigate to your testpy3 virtualenv (eg in /home/user/.virtualenvs). Through PyQt4 doesn't appear in the package list, PyCharm detected it and PyQt4 gui's are working for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM