python3.4中的QWebPage和pymongo在哪里可以找到?

Posted

技术标签:

【中文标题】python3.4中的QWebPage和pymongo在哪里可以找到?【英文标题】:Where can I find the QWebPage and pymongo in python3.4? 【发布时间】:2016-01-29 23:21:52 【问题描述】:

我正在处理一些需要来自 python qt 5 的多个包的代码。导入 QWebPage 模块时出现缺少包错误:

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

我正在开发 debian 并已安装软件包:libqtwebkit-devfromlibqtwebkit-devlibqt5webkit5-dev。我目前的包裹是:

$ 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

我错过了什么?

编辑:

安装python3-pyqt5.qtwebkit 后出现以下缺失模块错误:

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

我已经使用 pip 安装了cython

# pip install cython

python3.4 需要 cython

# apt-get install python3-pip
pip3 install cython

编辑#2:

接下来,python3.4需要pymongo

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

我已经使用 pip3 安装了软件包:

pip3 install pymongo

但是python还是找不到,为什么?

编辑#3:

阅读this 的问题似乎pymongo 3.x.x 不再有连接类。

$ pip freeze | grep pymongo
pymongo==3.2

编辑#4:

我尝试降级pymongo,但错误仍然存​​在:

pip install pymongo==2.7.2

编辑#5:

为了将pymongopython3.4 一起使用,它应该与pip3 一起安装:

pip3 install pymongo==2.7.2

【问题讨论】:

您最初的问题是关于 pyqt5 webkit,我认为现在已经解决了。新的编辑似乎与一个完全不同的问题有关。您到底要安装什么,为什么不使用 cython/pymongo 的官方 debian 软件包? 它们是我必须使用的专有 python 脚本中的依赖问题。我设法包含了所有模块(后来我不得不使用 pip3 来安装 pymongo)。我将编辑标题以完全匹配问题。 【参考方案1】:

好像pyqt5在debian上被拆分成很多小包:

Packages: Source Package: pyqt5

所以看起来你需要 python3-pyqt5.qtwebkit

【讨论】:

以上是关于python3.4中的QWebPage和pymongo在哪里可以找到?的主要内容,如果未能解决你的问题,请参考以下文章

使用 PySide 覆盖 QWebPage 中的 shouldInterruptJavaScript

首次加载后 QWebPage 无法正常工作

如何复制 QWebPage?

如何在非 GUI 应用程序中使用 QWebPage

如何从 QWebPage 使用的 QNetworkReply 读取数据?

使用 QWebPage 抓取多个 url