Where can I find the QWebPage and pymongo in pytho

2019-08-14 05:06发布

问题:

I'm working on some code that requires a number of packages from python qt 5. I get a missing package error upon importing the QWebPage module:

from PyQt5.Qt import QWebPage, QWebSettings
ImportError: cannot import name 'QWebPage'

I'm working on debian and already installed packages: libqtwebkit-devfrom, libqtwebkit-dev and libqt5webkit5-dev. My current packages are:

$ dpkg -l | grep qt*
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
ii  accountsservice                       0.6.37-3+b1                          amd64        query and manipulate user account information
ii  bzip2                                 1.0.6-7+b3                           amd64        high-quality block-sorting file compressor - utilities
ii  bzip2-doc                             1.0.6-7                              all          high-quality block-sorting file compressor - documentation
ii  debian-faq                            5.0.3                                all          Debian Frequently Asked Questions
ii  dnsmasq-base                          2.72-3+deb8u1                        amd64        Small caching DNS proxy and DHCP/TFTP server
ii  gnome-sushi                           3.12.0-2+b1                          amd64        sushi is a quick previewer for nautilus
ii  imagemagick-6.q16                     8:6.8.9.9-5                          amd64        image manipulation programs -- quantum depth Q16
ii  insserv                               1.14.0-5                             amd64        boot sequence organizer using LSB init.d script dependency information
ii  iputils-arping                        3:20121221-5+b2                      amd64        Tool to send ICMP echo requests to an ARP address
ii  libaccountsservice0                   0.6.37-3+b1                          amd64        query and manipulate user account information - shared libraries
ii  libaprutil1-dbd-sqlite3:amd64         1.5.4-1                              amd64        Apache Portable Runtime Utility Library - SQLite3 Driver
ii  libasyncns0:amd64                     0.8-5                                amd64        Asynchronous name service query library
ii  libbz2-1.0:amd64                      1.0.6-7+b3                           amd64        high-quality block-sorting file compressor library - runtime
ii  libbz2-dev:amd64                      1.0.6-7+b3                           amd64        high-quality block-sorting file compressor library - development
ii  libdirac-encoder0:amd64               1.0.2-7.1                            amd64        open and royalty free high quality video codec - encoder library
ii  libhsqldb1.8.0-java                   1.8.0.10+dfsg-3                      all          Java SQL database engine
ii  libimage-magick-q16-perl              8:6.8.9.9-5                          amd64        Perl interface to the ImageMagick graphics routines -- Q16 version
ii  libjs-jquery                          1.7.2+dfsg-3.2                       all          JavaScript library for dynamic web applications
ii  liblqr-1-0:amd64                      0.4.2-2                              amd64        converts plain array images into multi-size representation
ii  libmagick++-6.q16-5:amd64             8:6.8.9.9-5                          amd64        object-oriented C++ interface to ImageMagick
ii  libmagickcore-6.q16-2:amd64           8:6.8.9.9-5                          amd64        low-level image manipulation library -- quantum depth Q16
ii  libmagickcore-6.q16-2-extra:amd64     8:6.8.9.9-5                          amd64        low-level image manipulation library - extra codecs (Q16)
ii  libmagickwand-6.q16-2:amd64           8:6.8.9.9-5                          amd64        image manipulation library
ii  libmysqlclient18:amd64                5.5.46-0+deb8u1                      amd64        MySQL database client library
ii  libpoppler-qt4-4:amd64                0.26.5-2                             amd64        PDF rendering library (Qt 4 based shared library)
ii  libpwquality-common                   1.2.3-1                              all          library for password quality checking and generation (data files)
ii  libpwquality1:amd64                   1.2.3-1                              amd64        library for password quality checking and generation
ii  libqmi-glib1:amd64                    1.10.2-2                             amd64        Support library to use the Qualcomm MSM Interface (QMI) protocol
ii  libqmi-proxy                          1.10.2-2                             amd64        Proxy to communicate with QMI ports
ii  libqpdf13:amd64                       5.1.2-2                              amd64        runtime library for PDF transformation/inspection software
ii  libqqwing2:amd64                      1.3.2-1                              amd64        tool for generating and solving Sudoku puzzles (library)
ii  libqt4-dbus:amd64                     4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 D-Bus module
ii  libqt4-declarative:amd64              4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 Declarative module
ii  libqt4-designer:amd64                 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 designer module
ii  libqt4-dev                            4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 development files
ii  libqt4-dev-bin                        4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 development programs
ii  libqt4-help:amd64                     4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 help module
ii  libqt4-network:amd64                  4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 network module
ii  libqt4-opengl:amd64                   4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 OpenGL module
ii  libqt4-opengl-dev                     4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 OpenGL library development files
ii  libqt4-qt3support:amd64               4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 3 compatibility library for Qt 4
ii  libqt4-script:amd64                   4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 script module
ii  libqt4-scripttools:amd64              4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 script tools module
ii  libqt4-sql:amd64                      4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 SQL module
ii  libqt4-sql-mysql:amd64                4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 MySQL database driver
ii  libqt4-svg:amd64                      4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 SVG module
ii  libqt4-test:amd64                     4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 test module
ii  libqt4-xml:amd64                      4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 XML module
ii  libqt4-xmlpatterns:amd64              4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 XML patterns module
ii  libqt5clucene5:amd64                  5.3.2-3                              amd64        Qt 5 CLucene module
ii  libqt5concurrent5:amd64               5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 concurrent module
ii  libqt5core5a:amd64                    5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 core module
ii  libqt5dbus5:amd64                     5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 D-Bus module
ii  libqt5declarative5:amd64              5.3.2-3                              amd64        Qt Quick 1 module for Qt 5
ii  libqt5designer5:amd64                 5.3.2-3                              amd64        Qt 5 designer module
ii  libqt5designercomponents5:amd64       5.3.2-3                              amd64        Qt 5 Designer components module
ii  libqt5gui5:amd64                      5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 GUI module
ii  libqt5help5:amd64                     5.3.2-3                              amd64        Qt 5 help module
ii  libqt5network5:amd64                  5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 network module
ii  libqt5opengl5:amd64                   5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 OpenGL module
ii  libqt5opengl5-dev:amd64               5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 OpenGL library development files
ii  libqt5printsupport5:amd64             5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 print support module
ii  libqt5qml5:amd64                      5.3.2-4                              amd64        Qt 5 QML module
ii  libqt5quick5:amd64                    5.3.2-4                              amd64        Qt 5 Quick library
ii  libqt5quickparticles5:amd64           5.3.2-4                              amd64        Qt 5 Quick particules module
ii  libqt5quicktest5:amd64                5.3.2-4                              amd64        Qt 5 Quick Test library
ii  libqt5quickwidgets5:amd64             5.3.2-4                              amd64        Qt 5 Quick Widgets library
ii  libqt5script5:amd64                   5.3.2+dfsg-2                         amd64        Qt 5 script module
ii  libqt5sql5:amd64                      5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 SQL module
ii  libqt5sql5-sqlite:amd64               5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 SQLite 3 database driver
ii  libqt5test5:amd64                     5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 test module
ii  libqt5webkit5:amd64                   5.3.2+dfsg-4                         amd64        Web content engine library for Qt
ii  libqt5webkit5-dev:amd64               5.3.2+dfsg-4                         amd64        Web content engine library for Qt - development files
ii  libqt5widgets5:amd64                  5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 widgets module
ii  libqt5x11extras5:amd64                5.3.2-2                              amd64        Qt 5 X11 extras
ii  libqt5xml5:amd64                      5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 XML module
ii  libqt5xmlpatterns5:amd64              5.3.2-2                              amd64        Qt 5 XML patterns module
ii  libqtcore4:amd64                      4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 core module
ii  libqtdbus4:amd64                      4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 D-Bus module library
ii  libqtgui4:amd64                       4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 GUI module
ii  libqtwebkit-dev                       2.3.4.dfsg-3                         amd64        Web content engine library for Qt - development files
ii  libqtwebkit4:amd64                    2.3.4.dfsg-3                         amd64        Web content engine library for Qt
ii  libquadmath0:amd64                    4.9.2-10                             amd64        GCC Quad-Precision Math Library
ii  libquvi-scripts                       0.4.21-2                             all          library for parsing video download links (Lua scripts)
ii  libquvi7:amd64                        0.4.1-3                              amd64        library for parsing video download links (runtime libraries)
ii  librasqal3:amd64                      0.9.32-1                             amd64        Rasqal RDF query library
ii  libreoffice-math                      1:4.3.3-2+deb8u2                     amd64        office productivity suite -- equation editor
ii  libreoffice-sdbc-hsqldb               1:4.3.3-2+deb8u2                     amd64        HSQLDB SDBC driver for LibreOffice
ii  libsqlite3-0:amd64                    3.8.7.1-1+deb8u1                     amd64        SQLite 3 shared library
ii  libsqlite3-dev:amd64                  3.8.7.1-1+deb8u1                     amd64        SQLite 3 development files
ii  libtracker-sparql-1.0-0:amd64         1.2.4-2                              amd64        metadata database, indexer and search tool - library
ii  libuuid1:amd64                        2.25.2-6                             amd64        Universally Unique ID library
ii  libwacom-common                       0.8-1                                all          Wacom model feature query library (common files)
ii  libwacom2:amd64                       0.8-1                                amd64        Wacom model feature query library
ii  libwrap0:amd64                        7.6.q-25                             amd64        Wietse Venema's TCP wrappers library
ii  mlocate                               0.26-1                               amd64        quickly find files on the filesystem based on their name
ii  mysql-common                          5.5.46-0+deb8u1                      all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  prerex                                6.5.3-1                              amd64        course prerequisite chart editor for LaTeX/TikZ
ii  python3-pyqt5                         5.3.2+dfsg-3                         amd64        Python 3 bindings for Qt5
ii  qdbus                                 4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 D-Bus tool
ii  qml-module-qtquick-controls:amd64     5.3.2-2                              amd64        Qt 5 Quick Controls QML module
ii  qml-module-qtquick-layouts:amd64      5.3.2-2                              amd64        Qt 5 Quick Layouts QML module
ii  qml-module-qtquick-window2:amd64      5.3.2-4                              amd64        Qt 5 window 2 QML module
ii  qml-module-qtquick2:amd64             5.3.2-4                              amd64        Qt 5 Qt Quick 2 QML module
ii  qpdf                                  5.1.2-2                              amd64        tools for and transforming and inspecting PDF files
ii  qt-at-spi:amd64                       0.3.1-5                              amd64        at-spi accessibility plugin for Qt
ii  qt4-linguist-tools                    4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 Linguist tools
ii  qt4-qmake                             4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 qmake Makefile generator tool
ii  qt5-default                           5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 development defaults package
ii  qt5-doc                               5.3.2-3                              all          Qt 5 API Documentation
ii  qt5-qmake:amd64                       5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 qmake Makefile generator tool
ii  qtbase5-dev:amd64                     5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 base development files
ii  qtbase5-dev-tools                     5.3.2+dfsg-4+deb8u1                  amd64        Qt 5 base development programs
ii  qtbase5-doc                           5.3.2-3                              all          Qt 5 base documentation
ii  qtchooser                             47-gd2b7997-2                        amd64        Wrapper to select between Qt development binary versions
ii  qtcore4-l10n                          4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 all          Qt 4 core module translations
ii  qtcreator                             3.2.1+dfsg-7                         amd64        lightweight integrated development environment (IDE) for Qt
ii  qtcreator-data                        3.2.1+dfsg-7                         all          application data for Qt Creator IDE
ii  qtcreator-doc                         3.2.1+dfsg-7                         all          documentation for Qt Creator IDE
ii  qtdeclarative5-dev:amd64              5.3.2-4                              amd64        Qt 5 declarative development files
ii  qtdeclarative5-dev-tools              5.3.2-4                              amd64        Qt 5 declarative development programs
ii  qtdeclarative5-doc                    5.3.2-3                              all          Qt 5 declarative documentation
ii  qtenginio5-doc                        5.3.2-2                              all          Qt 5 Enginio documentation
ii  qtgraphicaleffects5-doc               5.3.2-2                              all          Qt 5 graphical effects documentation
ii  qtmultimedia5-doc                     5.3.2-5                              all          Qt 5 multimedia documentation
ii  qtpositioning5-doc                    5.3.2-2                              all          Qt 5 Positioning documentation
ii  qtquick1-5-dev-tools                  5.3.2-3                              amd64        Qt Quick 1 tools
ii  qtquickcontrols5-doc                  5.3.2-2                              all          Qt 5 Quick Controls documentation
ii  qtscript5-doc                         5.3.2-3                              all          Qt 5 script documentation
ii  qtsensors5-doc                        5.3.2+dfsg-2                         all          Qt 5 Sensors documentation
ii  qtserialport5-doc                     5.3.2-2                              all          Qt 5 serial port documentation
ii  qtsvg5-doc                            5.3.2-2                              all          Qt 5 SVG documentation
ii  qttools5-dev-tools                    5.3.2-3                              amd64        Qt 5 development tools
ii  qttools5-doc                          5.3.2-3                              all          Qt 5 tools documentation
ii  qttranslations5-l10n                  5.3.2-2                              all          translations for Qt 5
ii  qtwebkit5-doc                         5.3.2-3                              all          Qt 5 webkit documentation
ii  qtwebkit5-examples-doc                5.3.2+dfsg-2                         all          Qt 5 webkit examples documentation
ii  qtwebsockets5-doc                     5.3.2-5                              all          Qt 5 Web Sockets documentation
ii  qtx11extras5-doc                      5.3.2-2                              all          Qt 5 X11 extras documentation
ii  qtxmlpatterns5-dev-tools              5.3.2-2                              amd64        Qt 5 XML patterns development programs
ii  qtxmlpatterns5-doc                    5.3.2-3                              all          Qt 5 XML patterns documentation
ii  quadrapassel                          1:3.14.0-1                           amd64        popular Russian game, similar to Tetris
ii  sqlite3                               3.8.7.1-1+deb8u1                     amd64        Command line interface for SQLite 3
ii  tcpd                                  7.6.q-25                             amd64        Wietse Venema's TCP wrapper utilities
ii  vprerex                               6.5.3-1                              amd64        Qt interface to prerex, a course prerequisite chart editor
ii  xserver-xorg-video-qxl                0.1.1-2+b1                           amd64        X.Org X server -- QXL display driver

What am I missing?

Edit:

After installing python3-pyqt5.qtwebkit I get the following missing module error:

from Cython.Compiler.Options import normalise_encoding_name
ImportError: No module named 'Cython'

I have installed cython using pip:

# pip install cython

and needed cython for python3.4:

# apt-get install python3-pip
pip3 install cython

Edit #2:

Next, python3.4 need pymongo:

from pymongo.connection import Connection
ImportError: No module named 'pymongo.connection'

I have installed the packages using pip3:

pip3 install pymongo

but python still cannot find it, why?

Edit #3:

Reading this question it seems that pymongo 3.x.x does no longer have a connection class.

$ pip freeze | grep pymongo
pymongo==3.2

Edit #4:

I tried downgrading pymongo but the error persists:

pip install pymongo==2.7.2

Edit #5:

In order to use pymongo with python3.4 it should be installed with pip3:

pip3 install pymongo==2.7.2

回答1:

It seems that pyqt5 is split up into many small packages on debian:

  • Packages: Source Package: pyqt5

So it looks like you'll need python3-pyqt5.qtwebkit.