Leopard上查找Python随附的默认软件包时遇到问题

Leopard上查找Python随附的默认软件包时遇到问题

本文介绍了在Snow Leopard上查找Python随附的默认软件包时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题.

首先,我如何找出Mac OS-X 10.6.8 Snow Leopard随附的Python模块(及其版本)?

第二,与雪豹和Tix怎么办?我绝对不明白这一点.如果导入Tix,则没有错误.如果我以交互方式键入

>>> help(Tix)

我获得了有关使用Tix的大量信息.如果我再进一步的话,这会发生...

>>> root = Tix.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tix.py", line 210, in __init__
_tkinter.TclError: can't find package Tix
>>>

哦,寡妇会打开,但我仍然会收到错误消息.我单击窗口,然后注意到菜单栏上显示"Python".在文件"下,我看到运行小部件演示".我启动它,然后运行每个Tix演示.当我单击演示的查看代码"时,我看到它全部在Tcl中(我假设是).

Tcl/Tk是8.5x版,已经安装了Tix,我可以用Python导入它,但是我不能使用它?

解决方案

  • Mac OS X 10.6随附Python 2.6.1.

  • 该平台上的TKinter版本为Apple 8.5.7,存在已知问题;例如,IDLE将不运行它.

请参见在Mac OS X页面上使用Tcl/Tk进行IDLE和tkinter 有关更多详细信息,请访问Python.org.

在10.6机器上help('modules')的终端输出:

$ sw_vers -productVersion
10.6.8
$ /usr/bin/python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')

Please wait a moment while I gather a list of all available modules...

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained.
  __import__(name)
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future.
  warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.")
2013-01-10 09:36:31.224 Python[68800:b07] Error loading /Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit:  dlopen(/Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit, 265): Library not loaded: @rpath/DevToolsRemoteClient.framework/Versions/A/DevToolsRemoteClient
  Referenced from: /Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit
  Reason: image not found
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.
  __import__(name)
AddressBook         _Win                dumbdbm             py2app
AppKit              __builtin__         dummy_thread        py_compile
AppleScriptKit      __future__          dummy_threading     pyclbr
Audio_mac           _abcoll             easy_install        pydoc
Automator           _ast                email               pydoc_topics
BaseHTTPServer      _bisect             encodings           pyexpat
Bastion             _builtinSuites      errno               pygame
CFNetwork           _bytesio            exceptions          quopri
CGIHTTPServer       _codecs             ez_setup            random
CalendarStore       _codecs_cn          fcntl               re
Canvas              _codecs_hk          fetchmailconf       readline
Carbon              _codecs_iso2022     filecmp             repr
Cocoa               _codecs_jp          fileinput           resource
CodeWarrior         _codecs_kr          findertools         rexec
Collaboration       _codecs_tw          fnmatch             rfc822
ColorPicker         _collections        formatter           rlcompleter
ConfigParser        _csv                fpformat            robotparser
Cookie              _ctypes             fractions           runpy
CoreData            _ctypes_test        ftplib              sched
CoreFoundation      _curses             functools           select
CoreGraphics        _curses_panel       future_builtins     sets
CoreText            _elementtree        gc                  setuptools
Dialog              _fileio             genericpath         sgmllib
DictionaryServices  _functools          gensuitemodule      sha
DocXMLRPCServer     _hashlib            gestalt             shelve
EasyDialogs         _heapq              getopt              shlex
ExceptionHandling   _hotshot            getpass             shutil
Explorer            _json               gettext             signal
FSEvents            _locale             glob                site
FileDialog          _lsprof             grp                 smtpd
Finder              _multibytecodec     gzip                smtplib
FixTk               _multiprocessing    hashlib             sndhdr
Foundation          _random             heapq               socket
FrameWork           _socket             hmac                sqlite3
HTMLParser          _sqlite3            hotshot             sre
IN                  _sre                htmlentitydefs      sre_compile
InputMethodKit      _ssl                htmllib             sre_constants
InstallerPlugins    _strptime           httplib             sre_parse
InstantMessage      _struct             ic                  ssl
InterfaceBuilderKit _symtable           icglue              stat
JavaScriptCore      _testcapi           icopen              statvfs
LatentSemanticMapping _threading_local    idlelib             string
LaunchServices      _tkinter            ihooks              stringold
MacOS               _warnings           imageop             stringprep
Message             _weakref            imaplib             strop
MimeWriter          abc                 imghdr              struct
MiniAEFrame         aepack              imp                 subprocess
Nav                 aetools             imputil             sunau
Netscape            aetypes             inspect             sunaudio
OSATerminology      aifc                io                  svn
OpenSSL             altgraph            itertools           symbol
PixMapWrapper       anydbm              json                symtable
PreferencePanes     applesingle         keyword             sys
PubSub              appletrawmain       lib2to3             syslog
PyObjCTools         appletrunner        libsvn              tabnanny
PyRSS2Gen           argvemulator        linecache           tarfile
QTKit               array               locale              telnetlib
Quartz              ast                 logging             tempfile
Queue               asynchat            macerrors           terminalcommand
ScreenSaver         asyncore            macholib            termios
ScriptingBridge     atexit              macostools          test
ScrolledText        audiodev            macpath             textwrap
SearchKit           audioop             macresource         this
SimpleDialog        autoGIL             macurl2path         thread
SimpleHTTPServer    base64              mailbox             threading
SimpleXMLRPCServer  bdb                 mailcap             time
SocketServer        bdist_mpkg          markupbase          timeit
StdSuites           bgenlocations       marshal             tkColorChooser
StringIO            binascii            math                tkCommonDialog
SyncServices        binhex              md5                 tkFileDialog
SystemConfiguration bisect              mhlib               tkFont
SystemEvents        bonjour             mimetools           tkMessageBox
Tix                 bsddb               mimetypes           tkSimpleDialog
Tkconstants         bsddb185            mimify              toaiff
Tkdnd               buildtools          mmap                token
Tkinter             bundlebuilder       modulefinder        tokenize
UserDict            bz2                 modulegraph         trace
UserList            cPickle             multifile           traceback
UserString          cProfile            multiprocessing     tty
VBoxPython2_5       cStringIO           mutex               turtle
VBoxPython2_6       calendar            netrc               twisted
WebKit              cfmfile             new                 types
XgridFoundation     cgi                 nis                 unicodedata
_AE                 cgitb               nntplib             unittest
_AH                 chunk               ntpath              urllib
_App                cmath               nturl2path          urllib2
_CF                 cmd                 numbers             urlparse
_CG                 code                numpy               user
_CarbonEvt          codecs              objc                uu
_Cm                 codeop              opcode              uuid
_Ctl                collections         operator            vboxapi
_Dlg                colorsys            optparse            vboxshell
_Drag               commands            os                  videoreader
_Evt                compileall          os2emxpath          warnings
_File               compiler            parser              wave
_Fm                 contextlib          pdb                 weakref
_Folder             cookielib           pickle              webbrowser
_Help               copy                pickletools         whichdb
_IBCarbon           copy_reg            pimp                wsgiref
_Icn                crypt               pipes               wx
_LWPCookieJar       csv                 pkg_resources       wxPython
_Launch             ctypes              pkgutil             wxaddons
_List               curses              platform            wxversion
_Menu               datetime            plistlib            xattr
_Mlte               dateutil            popen2              xdrlib
_MozillaCookieJar   dbhash              poplib              xml
_OSA                dbm                 posix               xmllib
_Qd                 decimal             posixfile           xmlrpclib
_Qdoffs             difflib             posixpath           xxsubtype
_Qt                 dircache            pprint              zipfile
_Res                dis                 profile             zipimport
_Scrap              distutils           pstats              zlib
_Snd                dl                  pty                 zope
_TE                 doctest             pwd

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

pygamevboxapi(VBoxPython2_5VBoxPython2_6vboxapivboxshell)软件包是稍后在该计算机上安装的非默认加载项,其余应为标准问题. /p>

I have two questions.

First, how can I find out what Python modules (and their versions) come with Mac OS-X 10.6.8 Snow Leopard?

Second, what is the deal with Snow Leopard and Tix? I absolutely cannot understand this. If I import Tix, no errors. If I interactively type

>>> help(Tix)

I get megabytes of info on using Tix. If I go any further this happens...

>>> root = Tix.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tix.py", line 210, in __init__
_tkinter.TclError: can't find package Tix
>>>

Oh, the widow will open but I still get the error. I click the window and notice the menu bar said, "Python". Under, "File" I see, "Run Widget Demo". I start it up and every Tix demo runs. When I click the demo's, "See code" I see it's all in (what I assume to be) Tcl.

Tcl/Tk is version 8.5x, Tix is installed and I can import it with Python but I can't use it?

解决方案

  • Mac OS X 10.6 comes with Python 2.6.1.

  • The TKinter version on that platform is Apple 8.5.7 and has known problems; IDLE won't run with it, for example.

See the IDLE and tkinter with Tcl/Tk on Mac OS X page on Python.org for more details.

Terminal output for help('modules') on a 10.6 machine:

$ sw_vers -productVersion
10.6.8
$ /usr/bin/python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')

Please wait a moment while I gather a list of all available modules...

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained.
  __import__(name)
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future.
  warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.")
2013-01-10 09:36:31.224 Python[68800:b07] Error loading /Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit:  dlopen(/Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit, 265): Library not loaded: @rpath/DevToolsRemoteClient.framework/Versions/A/DevToolsRemoteClient
  Referenced from: /Developer/Library/Frameworks/InterfaceBuilderKit.framework/InterfaceBuilderKit
  Reason: image not found
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.
  __import__(name)
AddressBook         _Win                dumbdbm             py2app
AppKit              __builtin__         dummy_thread        py_compile
AppleScriptKit      __future__          dummy_threading     pyclbr
Audio_mac           _abcoll             easy_install        pydoc
Automator           _ast                email               pydoc_topics
BaseHTTPServer      _bisect             encodings           pyexpat
Bastion             _builtinSuites      errno               pygame
CFNetwork           _bytesio            exceptions          quopri
CGIHTTPServer       _codecs             ez_setup            random
CalendarStore       _codecs_cn          fcntl               re
Canvas              _codecs_hk          fetchmailconf       readline
Carbon              _codecs_iso2022     filecmp             repr
Cocoa               _codecs_jp          fileinput           resource
CodeWarrior         _codecs_kr          findertools         rexec
Collaboration       _codecs_tw          fnmatch             rfc822
ColorPicker         _collections        formatter           rlcompleter
ConfigParser        _csv                fpformat            robotparser
Cookie              _ctypes             fractions           runpy
CoreData            _ctypes_test        ftplib              sched
CoreFoundation      _curses             functools           select
CoreGraphics        _curses_panel       future_builtins     sets
CoreText            _elementtree        gc                  setuptools
Dialog              _fileio             genericpath         sgmllib
DictionaryServices  _functools          gensuitemodule      sha
DocXMLRPCServer     _hashlib            gestalt             shelve
EasyDialogs         _heapq              getopt              shlex
ExceptionHandling   _hotshot            getpass             shutil
Explorer            _json               gettext             signal
FSEvents            _locale             glob                site
FileDialog          _lsprof             grp                 smtpd
Finder              _multibytecodec     gzip                smtplib
FixTk               _multiprocessing    hashlib             sndhdr
Foundation          _random             heapq               socket
FrameWork           _socket             hmac                sqlite3
HTMLParser          _sqlite3            hotshot             sre
IN                  _sre                htmlentitydefs      sre_compile
InputMethodKit      _ssl                htmllib             sre_constants
InstallerPlugins    _strptime           httplib             sre_parse
InstantMessage      _struct             ic                  ssl
InterfaceBuilderKit _symtable           icglue              stat
JavaScriptCore      _testcapi           icopen              statvfs
LatentSemanticMapping _threading_local    idlelib             string
LaunchServices      _tkinter            ihooks              stringold
MacOS               _warnings           imageop             stringprep
Message             _weakref            imaplib             strop
MimeWriter          abc                 imghdr              struct
MiniAEFrame         aepack              imp                 subprocess
Nav                 aetools             imputil             sunau
Netscape            aetypes             inspect             sunaudio
OSATerminology      aifc                io                  svn
OpenSSL             altgraph            itertools           symbol
PixMapWrapper       anydbm              json                symtable
PreferencePanes     applesingle         keyword             sys
PubSub              appletrawmain       lib2to3             syslog
PyObjCTools         appletrunner        libsvn              tabnanny
PyRSS2Gen           argvemulator        linecache           tarfile
QTKit               array               locale              telnetlib
Quartz              ast                 logging             tempfile
Queue               asynchat            macerrors           terminalcommand
ScreenSaver         asyncore            macholib            termios
ScriptingBridge     atexit              macostools          test
ScrolledText        audiodev            macpath             textwrap
SearchKit           audioop             macresource         this
SimpleDialog        autoGIL             macurl2path         thread
SimpleHTTPServer    base64              mailbox             threading
SimpleXMLRPCServer  bdb                 mailcap             time
SocketServer        bdist_mpkg          markupbase          timeit
StdSuites           bgenlocations       marshal             tkColorChooser
StringIO            binascii            math                tkCommonDialog
SyncServices        binhex              md5                 tkFileDialog
SystemConfiguration bisect              mhlib               tkFont
SystemEvents        bonjour             mimetools           tkMessageBox
Tix                 bsddb               mimetypes           tkSimpleDialog
Tkconstants         bsddb185            mimify              toaiff
Tkdnd               buildtools          mmap                token
Tkinter             bundlebuilder       modulefinder        tokenize
UserDict            bz2                 modulegraph         trace
UserList            cPickle             multifile           traceback
UserString          cProfile            multiprocessing     tty
VBoxPython2_5       cStringIO           mutex               turtle
VBoxPython2_6       calendar            netrc               twisted
WebKit              cfmfile             new                 types
XgridFoundation     cgi                 nis                 unicodedata
_AE                 cgitb               nntplib             unittest
_AH                 chunk               ntpath              urllib
_App                cmath               nturl2path          urllib2
_CF                 cmd                 numbers             urlparse
_CG                 code                numpy               user
_CarbonEvt          codecs              objc                uu
_Cm                 codeop              opcode              uuid
_Ctl                collections         operator            vboxapi
_Dlg                colorsys            optparse            vboxshell
_Drag               commands            os                  videoreader
_Evt                compileall          os2emxpath          warnings
_File               compiler            parser              wave
_Fm                 contextlib          pdb                 weakref
_Folder             cookielib           pickle              webbrowser
_Help               copy                pickletools         whichdb
_IBCarbon           copy_reg            pimp                wsgiref
_Icn                crypt               pipes               wx
_LWPCookieJar       csv                 pkg_resources       wxPython
_Launch             ctypes              pkgutil             wxaddons
_List               curses              platform            wxversion
_Menu               datetime            plistlib            xattr
_Mlte               dateutil            popen2              xdrlib
_MozillaCookieJar   dbhash              poplib              xml
_OSA                dbm                 posix               xmllib
_Qd                 decimal             posixfile           xmlrpclib
_Qdoffs             difflib             posixpath           xxsubtype
_Qt                 dircache            pprint              zipfile
_Res                dis                 profile             zipimport
_Scrap              distutils           pstats              zlib
_Snd                dl                  pty                 zope
_TE                 doctest             pwd

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

The pygame and vboxapi (VBoxPython2_5, VBoxPython2_6, vboxapi, vboxshell) packages are non-default add-ons installed later on that machine, the rest should be standard issue.

这篇关于在Snow Leopard上查找Python随附的默认软件包时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 16:03