Tag Archives: PyQt5

ERROR: Adobe Flashplayer or HTML5 Browser with WebGL or CSS3D support requ

Error appears on the pyqt5 qwebengine VR interface: Adobe flashplayer or HTML5 browser with webgl or css3d support requ

The following sentences can prevent the interface from flickering. If you add more, the image above will appear. As long as you leave other comments and the last sentence, you can solve the interface flickering and play VR video.

from PyQt5.QtCore import *
from PyQt5.QtGui import *   

# QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL,True)
# QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL, True)
# QGuiApplication.setAttribute(Qt.AA_UseSoftwareOpenGL, True)
# QApplication.setAttribute(Qt.AA_UseSoftwareOpenGL, True)

QCoreApplication.setAttribute(Qt.AA_UseOpenGLES, True)

How to Solve pyqt5 imports module Error

Pyqt5 reports an error when importing the module:

1

ImportError: DLL load failed: Cannot find the specified program

2

ImportError: DLL load failed: Cannot find the specified program

3

ImportError: cannot import name 'QtCore'

The reason for the above error: the versions of pyqt5, pyqt5 SIP and pyqt5 stub modules are not interconnected

The solution is as follows:

    1. Open Win + R for operation, enter CMD to enter the terminal window, and enter it successively in the command line
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQt5-stubs

And the modules related to pyqt5 (such as pyqt5#u tools) are unloaded, and then input

pip install PyQt5

In this way, the installation already includes the corresponding versions of pyqt5 SIP and pyqt5 stubs. There is no need to install again, and then reinstall the modules related to pyqt5 (just uninstalled), such as PIP install pyqt5_tools

This will run successfully!

Error: one input ui-file must be specified [How to Solve]

QT designer installed   After success, install PIP anyway   install PyQt5   And pip   Install pyqt5 designer is useless

So consider whether the installation path of QT designer is wrong. Therefore, searching designer.exe in the folder unexpectedly found 2 files.

The first path has been used before, but the UI file cannot be converted to py file. The link below was replaced.

OK after running the test

Hope to help you!

Error reporting processing of pyinstaller packaging geopandas environment

Article catalog

1. Iteration error of geopandas occurs when executing exe. 2. Fiona cannot be found when executing exe_ Shim3. Cannot find fiona.shema4. Summary by executing exe

First, use pyinstaller – F main.py to package the code into an EXE with a black window. The following are some problems and solutions

1. The iteration error of geopandas occurs when executing exe

The error information is as follows:

(gis_data_process) D:\code\gis_data_processing>main.exe
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    from gis_data_process import *
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "gis_data_process.py", line 7, in <module>
    import geopandas
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "geopandas\__init__.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "geopandas\datasets\__init__.py", line 6, in <module>
StopIteration
[24328] Failed to execute script 'main' due to unhandled exception!

The solution is as follows:

    comment geopandas\__ init__. Py line 17 code “import geopandas. Datasets # noqa” delete the build, dist and spec files generated by packaging and reuse pyinstaller – f main. Py packaging

    2. Execute exe and cannot find Fiona_ shim

    The error information is as follows:

    (gis_data_process) D:\code\gis_data_processing>main.exe
    Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x0000021A0C5D8DC8>>
    Traceback (most recent call last):
      File "main.py", line 156, in generate_file_execute
        generate_shapefile(file_path, shape_path)
      File "gis_data_process.py", line 172, in generate_shapefile
        kml_to_shapefile(kml_path, shape_path)
      File "gis_data_process.py", line 417, in kml_to_shapefile
        geojson_to_shapefile(geojson_path, shape_path)
      File "gis_data_process.py", line 220, in geojson_to_shapefile
        geometry = geopandas.read_file(geojson_path)
      File "geopandas\io\file.py", line 166, in _read_file
      File "geopandas\io\file.py", line 81, in _check_fiona
    ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
    Importing fiona resulted in: No module named 'fiona._shim'
    

    The solution is as follows:

      find the. Spec file generated by packaging, find hiddenimports, add “Fiona. _shim”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe

      3. Fiona.shema cannot be found by executing exe

      The error information is as follows:

      (gis_data_process) D:\code\gis_data_processing>main.exe
      Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x00000220B655B5E8>>
      Traceback (most recent call last):
        File "main.py", line 156, in generate_file_execute
          generate_shapefile(file_path, shape_path)
        File "gis_data_process.py", line 172, in generate_shapefile
          kml_to_shapefile(kml_path, shape_path)
        File "gis_data_process.py", line 417, in kml_to_shapefile
          geojson_to_shapefile(geojson_path, shape_path)
        File "gis_data_process.py", line 220, in geojson_to_shapefile
          geometry = geopandas.read_file(geojson_path)
        File "geopandas\io\file.py", line 166, in _read_file
        File "geopandas\io\file.py", line 81, in _check_fiona
      ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
      Importing fiona resulted in: No module named 'fiona.schema'
      

      The solution is as follows:

        find the. Spec file generated by packaging, find hiddenimports, add “Fiona. Schema”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe

        4. Summary

        After the above three steps are completed, you can successfully package into exe, but opening exe has a black window. You can change console = true to console = false in the spec file, and then use pyinstaller main.spec to package and generate exe, so that there is no black window

Pyqt5 Error: AttributeError: ‘QWidget‘ object has no attribute ‘setCentralWidget‘

problem

AttributeError: 'QWidget' object has no attribute 'setCentralWidget'

reason

We can see setcentralwidget in QT help document that it belongs to the method of qmainwindow class and is defined separately in its class, so it cannot be called directly for its parent class QWidget.

void QMainWindow::setCentralWidget(QWidget *widget)

decided

Write QtWidgets.QWidget() converts QtWidgets.QMainWindow().

[error reported] [Python] [Matplotlib] importerror: failed to import any QT binding

error message

ImportError: Failed to import any qt binding

complete error message:

Traceback (most recent call last):
  File "/home/xovee/Desktop/codes/www20/plot/cascade_plot.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2355, in <module>
    switch_backend(rcParams["backend"])
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/pyplot.py", line 221, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 5, in <module>
    from .backend_qt5agg import (
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 11, in <module>
    from .backend_qt5 import (
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 15, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 13, in <module>
    from matplotlib.backends.qt_compat import QtGui
  File "/home/xovee/miniconda3/envs/tf-2.0-a0/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 158, in <module>
    raise ImportError("Failed to import any qt binding")
ImportError: Failed to import any qt binding

environment

  • Ubuntu 18.4 LTS
  • Python 3.6
  • Matplotlib 3.1.1

    solution

    pip install PyQt5
    

    <标题>引用

      <> Foad。(2018年11月22日)。导入任何qt绑定、Python – Tensorflow失败。李从https://stackoverflow.com/questions/52346254/importerror-failed-to-import-any-qt-binding-python-tensorflow获取