为什么在 Python 3.4.3 和 PyCharm 的 PyQt5 中存在 ImportError?
Why is there an ImportError in PyQt5 with Python 3.4.3 and PyCharm?
我想在 PyCharm 使用 Python 3.4.3 使用 PyQt5 库。我安装了所有程序,但没有完全工作,PyCharm 出现错误:
C:\Python34\python.exeC:/Python34/Lib/sitepackages/PyQt5/examples/dbus/listnames.py
Traceback (most recent call last):
File "C:/Python34/Lib/site-packages/PyQt5/examples/dbus/listnames.py", line 47, in <module>
from PyQt5.QtCore import QCoreApplication
ImportError: DLL load failed: %1 is not a valid Win32 application.
Process finished with exit code 1
我的代码就是这样,我将模型从 PyQt5 导入 PyCharm 以创建一个简单的 window:
import sys
from PyQt5 import QtGui
def main():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
此错误仅在我使用 PyCharm 时出现,而不是在便携式 Python 中出现。那么有人可以告诉我如何使用 Python 3.4.3 和 PyQt5 设置 PyCharm 吗?如果这不是问题,请告诉我解决方案。
以下错误信息:
ImportError: DLL load failed: %1 is not a valid Win32 application.
说您的解释器(我怀疑它嵌入到 PyCharm 中)正在尝试导入 32 位模块。那只是因为解释器本身是 32 位的。这意味着 PyCharm 正在使用 Python.
的 32 位
考虑使用 64 位 PyCharm 或将 PyQt5 降级为 32 位。
免责声明:我没有使用 PyCharm。
我想在 PyCharm 使用 Python 3.4.3 使用 PyQt5 库。我安装了所有程序,但没有完全工作,PyCharm 出现错误:
C:\Python34\python.exeC:/Python34/Lib/sitepackages/PyQt5/examples/dbus/listnames.py
Traceback (most recent call last):
File "C:/Python34/Lib/site-packages/PyQt5/examples/dbus/listnames.py", line 47, in <module>
from PyQt5.QtCore import QCoreApplication
ImportError: DLL load failed: %1 is not a valid Win32 application.
Process finished with exit code 1
我的代码就是这样,我将模型从 PyQt5 导入 PyCharm 以创建一个简单的 window:
import sys
from PyQt5 import QtGui
def main():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
此错误仅在我使用 PyCharm 时出现,而不是在便携式 Python 中出现。那么有人可以告诉我如何使用 Python 3.4.3 和 PyQt5 设置 PyCharm 吗?如果这不是问题,请告诉我解决方案。
以下错误信息:
ImportError: DLL load failed: %1 is not a valid Win32 application.
说您的解释器(我怀疑它嵌入到 PyCharm 中)正在尝试导入 32 位模块。那只是因为解释器本身是 32 位的。这意味着 PyCharm 正在使用 Python.
的 32 位考虑使用 64 位 PyCharm 或将 PyQt5 降级为 32 位。
免责声明:我没有使用 PyCharm。