[导入PySide2时,DLL加载失败,仅在调试时

问题描述 投票:3回答:2

我面临一个奇怪的问题。我已经在我的PyCharm项目的虚拟环境中下载并安装了Qt for Python库(PySide2)。我使用Qt Designer和Im加载(.ui文件)创建了一个虚拟GUI,并通过我的python代码显示了GUI。每当我运行代码时,我都可以看到没有错误的GUI。但是,每当调试代码时,都会出现错误:

文件“ ... \ gui_pyside2.py”,第5行,在

from PySide2.QtWidgets import QApplication, QLabel, QLineEdit

ImportError:DLL加载失败:找不到指定的过程。

Pydev在此行崩溃:

#execute the script (note: it's important to compile first to have the filename set in debug mode)
exec(compile(contents+"\n", file, 'exec'), glob, loc)

我对可能的原因完全迷失了。似乎pydev正在干扰导入?我尝试使用导入语句而不是从导入中导入,但是问题仍然存在。有什么想法吗?

安装的版本:

  • PyCharm社区2018.1.4
  • pydev调试器(内部版本181.5087.37)
  • Python 3.6.6(v3.6.6:4cf1f54eb7,Jun 27 2018,03:37:03)[MSC v.190064位(AMD64)]
  • PySide2-5.11.1a1.dev1530373667-5.11.1.dist(技术预览,python绑定到Qt 5.11)
python qt pycharm pydev pyside2
2个回答
1
投票

回答我自己的问题:

结果是在Pycharm中有针对Pyside的兼容性设置:

PySide compatibility

将其设置为PySide,然后调试器运行。


0
投票

我有相同的问题,您可以尝试使用PyCharm Community 2019

© www.soinside.com 2019 - 2024. All rights reserved.