欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ModuleNotFoundError: No module named ‘PySide‘;qtpy.PythonQtError: No Qt bindings could be found

程序员文章站 2022-05-28 22:41:18
...
labelme_json_to_dataset apc2016_obj3.json -o apc2016_obj3_json

出现如下错误

Traceback (most recent call last):
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/qtpy/__init__.py", line 223, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/shaorenjie/.conda/envs/assemblenet/bin/labelme_json_to_dataset", line 11, in <module>
    load_entry_point('labelme==4.1.0', 'console_scripts', 'labelme_json_to_dataset')()
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2687, in load_entry_point
    return ep.load()
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2341, in load
    return self.resolve()
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2347, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/labelme-4.1.0-py3.6.egg/labelme/__init__.py", line 6, in <module>
    from qtpy import QT_VERSION
  File "/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/qtpy/__init__.py", line 229, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

错误原因:

/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/qtpy/__init__.py的如下出错
from PyQt5.QtCore import PYQT_VERSION_STR as PYQT_VERSION  # analysis:ignore

然后在python中测试出错代码报错信息

>>> from PyQt5.QtCore import PYQT_VERSION_STR
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/shaorenjie/anaconda3/lib/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/PyQt5/QtCore.abi3.so)

解决方法
对应so动态库没找到,在~/.bashrc中加入如下当前虚拟环境的lib目录即可

export LD_LIBRARY_PATH=/home/shaorenjie/.conda/envs/assemblenet/lib/python3.6/site-packages/PyQt5/Qt5/lib/:$LD_LIBRARY_PATH
相关标签: 人工智能