首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有PySide6/shiboken6的ImportError

具有PySide6/shiboken6的ImportError
EN

Stack Overflow用户
提问于 2021-01-25 07:53:20
回答 1查看 504关注 0票数 0

我试图让PySide6在Python3.8.0中运行。安装情况良好:

代码语言:javascript
复制
C:\>pip install pyside6
Collecting pyside6
  Using cached PySide6-6.0.0-6.0.0-cp36.cp37.cp38.cp39-none-win_amd64.whl (62.4 MB)
Collecting shiboken6==6.0.0
  Using cached shiboken6-6.0.0-6.0.0-cp36.cp37.cp38.cp39-none-win_amd64.whl (2.3 MB)
Installing collected packages: shiboken6, pyside6
Successfully installed pyside6-6.0.0 shiboken6-6.0.0

但我遇到了一个导入错误:

代码语言:javascript
复制
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySide6
PySide6/__init__.py: Unable to import shiboken6 from , C:\Python38\python38.zip, C:\Python38\DLLs, C:\Python38\lib, C:\Python38, C:\Python38\lib\site-packages
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\PySide6\__init__.py", line 107, in <module>
    _setupQtDirectories()
  File "C:\Python38\lib\site-packages\PySide6\__init__.py", line 57, in _setupQtDirectories
    import shiboken6
  File "C:\Python38\lib\site-packages\shiboken6\__init__.py", line 25, in <module>
    from .shiboken6 import *
ImportError: DLL load failed while importing shiboken6: The specified procedure could not be found.

我做错什么了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-08 17:32:05

我做错什么了?

我不相信你做错了什么。

我认为这是shiboken6版本<=6.0.0中的一个已知错误。这在PySide bug跟踪器:PYSIDE-932中有部分报道。

问题似乎是他们试图从zip文件中导入。来自版本6.3.0 of shiboken6.__init__中的注释

代码语言:javascript
复制
# PYSIDE-932: Python 2 cannot import 'zipfile' for embedding while being imported, itself.
# We simply pre-load all imports for the signature extension.
# Also, PyInstaller seems not always to be reliable in finding modules.
# We explicitly import everything that is needed:

评论上写着Python 2 cannot import,但是它应该读PySide2 cannot import,因为这个问题来自使用PySide 2Python 3.6

Qt文档提到使用更新版本的virtualenv来解决这个问题,但我不认为virtualenv是罪魁祸首。此外,最新的Python 3版本附带和使用venv。相反,我认为这是导入zip文件的一个问题。当巴瑞华沙/布雷特坎农和他们的团队在新版本的importlib.resources中引入Python 3时,这个问题可能已经解决了,后者特别能帮助处理zip文件。

在这里看到他们的谈话:

巴里华沙-让你的资源更快,与importlib.resources - PyCon 2018年

最终,我相信这在最新版本的shiboken6 (即6.3.0)中得到了解决。

试试看这是否有效。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65880821

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档