如何将 Pyqt 与 Enthought Canopy 一起使用 [英] How can I use Pyqt with Enthought Canopy

查看:93
本文介绍了如何将 Pyqt 与 Enthought Canopy 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 EPD,并且正在试用 Canopy(Windows 7 64 位,学术许可).当我第一次启动 Canopy 时,什么也没发生(没有 GUI,没有错误消息),我意识到这是因为我将 QT_API 设置为 pyqt.将 qt_api 更改为 pyside 允许我启动 Canopy.完成此操作后,我检查了是否通过 Canopy 包管理器安装了 pyqt.但是 Canopy 拒绝从 QT_API 设置为 pyqt 开始.我怎样才能解决这个问题?我有一个大项目,所有东西都在 pyqt 中,所以我想使用它.

I had EPD installed and am giving Canopy (Windows 7 64-bit, Academic license) a go. When I first started Canopy, nothing happened (no GUI, no error message) and I realized this is because I had QT_API set to pyqt. Changing qt_api to pyside allows me to start Canopy. After doing this I have checked that pyqt is installed through the Canopy package manager. However Canopy refuses to start with QT_API set to pyqt. How can I fix this? I have a big project with everything in pyqt, so I want to use it.

推荐答案

由于 Canopy GUI 应用程序在与 Canopy User Python 不同的进程中运行,因此它们可以使用不同的 GUI 后端.

Since Canopy GUI application runs in a different process than Canopy User Python, they can use different GUI backends.

目前,由于 PyQt 的 GPL 许可,Canopy GUI 应用程序仅适用于 Pyside.因此,我认为 Canopy GUI 应该忽略 QT_API(或在内部强制它),以便您可以根据需要为您的应用程序设置它.但是从您的报告来看,情况似乎并非如此.

At present, the Canopy GUI application is Pyside-only, because of PyQt's GPL license. I think, therefore, that Canopy GUI should be ignoring QT_API (or internally forcing it), so that you could set it however you want for your application. However from your report this does not seem to be the case.

作为一种解决方法,我会尝试的第一件事是通过设置 os.environ['QT_API'] = 'pyqt' 来开始您的主模块(在任何后端相关的导入之前).

As a workaround, the first thing that I would try would be to begin your main module (before any backend-dependent imports) by setting os.environ['QT_API'] = 'pyqt'.

这篇关于如何将 Pyqt 与 Enthought Canopy 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆