简体   繁体   English

Py2App找不到可用的tk.tcl

[英]Py2App can't find usable tk.tcl

I'm trying to create an OS X Python 3 app with py2app using a Tkinter GUI. 我正在尝试使用Tkinter GUI使用py2app创建OS X Python 3应用程序。 I have upgraded Python on my machine to v3.6.0 and installed the correct version of ActiveTcl (v8.5.18.0). 我已在计算机上将Python升级到v3.6.0,并安装了正确版本的ActiveTcl(v8.5.18.0)。 I can develop and run the app fine, I can create an alias build and it runs fine but when I create and try to run a standalone version, I get an error saying that tk.tcl can not be found. 我可以很好地开发和运行该应用程序,可以创建一个别名版本,并且可以正常运行,但是当我创建并尝试运行独立版本时,出现错误, tk.tcl找不到tk.tcl

I have scoured the internet and have found older references to this online with other missing files but I can not find any solution which fixes my problem. 我已经搜寻了互联网,并在网上找到了较早的参考资料,以及其他丢失的文件,但是找不到任何解决问题的解决方案。 I know where my tk.tcl file is, but I don't know how to tell it where to look for it, and I don't know why it's in a non-standard place anyway. 我知道我的tk.tcl文件在哪里,但是我不知道如何告诉它在哪里寻找它,而且我也不知道为什么它在非标准位置。

Can anyone help me with this? 谁能帮我这个?

Full error message below: 完整的错误消息如下:

Traceback (most recent call last):
  File "/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/Resources/__boot__.py", line 81, in <module>
    _run()
  File "/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/Resources/__boot__.py", line 66, in _run
    exec(compile(source, path, 'exec'), globals(), globals())
  File "/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/Resources/test.py", line 10, in <module>
    gui = tk.Tk()
  File "tkinter/__init__.pyc", line 2017, in __init__
_tkinter.TclError: Can't find a usable tk.tcl in the following directories: 

/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5
/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5/Resources/Scripts
/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5
/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5/Resources/Scripts
/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/lib/tk8.5
/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/lib/tk8.5/Resources/Scripts
~/Library/Tcl/tk8.5 ~/Library/Tcl/tk8.5/Resources/Scripts /Library/Tcl/tk8.5
/Library/Tcl/tk8.5/Resources/Scripts
/System/Library/Tcl/tk8.5
/System/Library/Tcl/tk8.5/Resources/Scripts
~/Library/Frameworks/tk8.5
~/Library/Frameworks/tk8.5/Resources/Scripts
/Library/Frameworks/tk8.5
/Library/Frameworks/tk8.5/Resources/Scripts
/System/Library/Frameworks/tk8.5
/System/Library/Frameworks/tk8.5/Resources/Scripts
/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/lib/tk8.5
/Users/Ste/Documents/Programming/rf-library/src/test/dist/test.app/Contents/library



This probably means that tk wasn't installed properly.

called Tcl_CreateHashEntry on deleted table
Abort trap: 6

What version of py2app are you using? 您正在使用哪个版本的py2app? I had the same issue, but I was able to resolve it by downgrading to py2app 0.11 . 我遇到了同样的问题,但是我可以通过降级到py2app 0.11来解决它。 I am using Python 3.5.2 (the one distributed here https://www.python.org/download/releases/3.5.2/ ), and ActiveTcl 8.5.18.0 ( https://www.activestate.com/activetcl/downloads ). 我正在使用Python 3.5.2 (在此分发https://www.python.org/download/releases/3.5.2/ )和ActiveTcl 8.5.18.0https://www.activestate.com/activetcl/下载 )。 It works like a charm. 它像一种魅力。

If you use pip, simply do the following in Terminal: 如果使用pip,只需在终端中执行以下操作:

$ pip3 uninstall py2app
$ pip3 install py2app==0.11

Just FYI, I recently upgraded my Python version and a number of things (including py2app ). 仅供参考,我最近升级了我的Python版本和许多功能(包括py2app )。 I was under the impression that Python was the culprit. 我觉得Python是元凶。 So I tried Python 3.7.0, 3.6.6, and 3.5.4. 所以我尝试了Python 3.7.0、3.6.6和3.5.4。 All this time I was using py2app 0.12 , without thinking that the problem could be py2app. 一直以来,我一直在使用py2app 0.12 ,而没有想到问题可能出在py2app上。 I also un-installed and re-installed ActiveTcl 8.5.18 multiple times, and I can confirm that was not the issue. 我还多次卸载并重新安装了ActiveTcl 8.5.18,并且可以确认这不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM