[英]GUI with Python, Tkinter and AppJar
在python上運行GUI代碼時遇到錯誤。 我正在使用Mac。 相同的代碼可以在其他計算機上完美運行。
這個基本的函數調用給了我這個錯誤。 有人可以幫忙嗎?
>>> from appJar import gui
>>> app = gui()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appJar/appjar.py", line 410, in __init__
self.exe_file = os.path.basename(theMain.__file__)
AttributeError: module '__main__' has no attribute '__file__'
行首的“ >>>”表示您正在使用外殼程序。 這可能是為什么它不起作用的原因。 當您在窗口中使用此處時,轉到file-> new並將其寫入其中。 應該沒事。
我下載並在Windows中設置了路徑,但是沒有用。
但是幾行代碼解決了我遇到的類似問題
import sys
sys.path.append("C:\Program Files\Python36\Lib")
當然,您必須適應設置的sys.path
。
我做了幾件事。 這是一個奇跡。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.