Вопрос

I am trying to build pyqt5 for my virtualenv but there is no QtWidgets package or module or whatever it should be. And I can't import QtGui. This is how I try to build it:

python configure.py --qmake=/opt/Qt/5.2.0/gcc_64/bin/qmake
make
make install
Это было полезно?

Решение 2

PyQt5 install using the python3-sip standard package

I faced the same problem yesterday. I solved it on Ubunutu 13.10 by removing the python3-sip package to which the PyQt5 installation seemed to refer to.

sudo apt-get remove python3-sip

and cleanup :

sudo apt-get autoremove

then install again sip 4.15.5 & PyQt5 in fresh environments (make clean) or restore the source directories.

Note : Some PyQt5 libraries (graphic based) lake for me after the installation. I had to install the libgl1-mesa-dev package before re-installing.

Hope that could help you.

Другие советы

I found myself in the same situation with fresh Ubuntu install. I could import QCore, but not QWidgets or QGui (or several others).

Look at the output of configure.py, there should be a line:

These PyQt5 modules will be built: QtCore, QtGui, QtHelp, QtMultimedia, QtMultimediaWidgets, QtNetwork, QtOpenGL, QtPrintSupport, QtQml, QtQuick, QtSql, QtSvg, QtTest, QtWebKit, QtWebKitWidgets, QtWidgets, QtXml, QtXmlPatterns, QtDesigner, QtDBus, _QOpenGLFunctions_2_0, QtSensors, QtSerialPort, QtX11Extras, QtBluetooth, QtPositioning, QtQuickWidgets, QtWebSockets, Enginio, QtWebChannel, QtWebEngineWidgets

If this list is considerably shorter, missing QtGui etc, your installation may be missing OpenGL. In my case...

sudo apt-get install freeglut3-dev

...installed enough graphics-related stuff so that the configure decided that it can try to build all modules. It is confusing, as the configure.py doesn't give an error (unless you use --verbose -flag), it just omits the modules it can't make. If it is not OpenGL, use --verbose with configure.py to find what is causing problems.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top