[英]Can't import EasyDialogs - ImportError: No module named _Dlg
I'm trying to use the EasyDialogs python module to produce some simple dialog boxes for my python script on OSX. 我正在尝试使用EasyDialogs python模块为OSX上的python脚本生成一些简单的对话框。 Whenever I try and import the EasyDialogs module I get the following error: 每当我尝试导入EasyDialogs模块时,都会出现以下错误:
>>> import EasyDialogs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/plat-mac/EasyDialogs.py", line 24, in <module>
from Carbon.Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog
File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/plat-mac/Carbon/Dlg.py", line 1, in <module>
from _Dlg import *
ImportError: No module named _Dlg
I've tried doing easy_install Carbon
, as I thought it may be due to some issue with the Carbon package for python, but that hasn't helped. 我尝试过进行easy_install Carbon
,因为我认为这可能是由于python的Carbon包出现了问题,但这并没有帮助。 Any ideas? 有任何想法吗?
From the paths in your traceback, you appear to be using a 64-bit Enthought Python Distribution. 从回溯中的路径来看,您似乎正在使用64位的Enthought Python发行版。 The EasyDialogs
module uses various OS X Carbon interfaces, many of which OS X only provides 32-bit versions and have been deprecated by Apple. EasyDialogs
模块使用各种OS X Carbon接口,其中许多OS X仅提供32位版本,Apple已弃用。 For this reason, the Python Carbon
wrapper and EasyDialogs
modules are deprecated in Python 2 and have been removed in Python 3. While they may work in 32-bit mode, you should avoid using them in new code. 因此,Python Carbon
包装器和EasyDialogs
模块在Python 2中已弃用,而在Python 3中已被删除。尽管它们可能在32位模式下工作,但应避免在新代码中使用它们。 There are other alternatives available: Tkinter
in the standard library, various cross platform GUI frameworks (see here ). 还有其他替代方法:标准库中的Tkinter
,各种跨平台GUI框架(请参阅此处 )。 For more simple dialogs, you could also use the osax package in appscript to use the User Interaction
suite of AppleScript's Standard Additions
. 欲了解更多简单的对话框,您也可以使用osax包appscript使用User Interaction
的AppleScript的套件Standard Additions
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.