iT邦幫忙

0

python toga打包後無法執行

  • 分享至 

  • xImage

使用python toga寫一個GUI程式,使用pyinstaller打包完後執行程式跑出以下錯誤

Traceback (most recent call last):
  File "app.py", line 1, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "toga\__init__.py", line 118, in <module>
  File "toga\__init__.py", line 115, in _package_version
  File "importlib\metadata\__init__.py", line 996, in version
  File "importlib\metadata\__init__.py", line 969, in distribution
  File "importlib\metadata\__init__.py", line 548, in from_name
importlib.metadata.PackageNotFoundError: No package metadata was found for toga-core
[1764] Failed to execute script 'app' due to unhandled exception!

(程式沒包之前都可以正常執行。改成官方的hello world!試過了包之後還是會出現上述問題)
作業系統Windows11
python版本3.10.11
toga版本0.3.1
pyinstaller版本5.10.1
對於打包這部分不是很熟悉,請各位大大解惑

看更多先前的討論...收起先前的討論...
ccutmis iT邦高手 2 級 ‧ 2023-04-25 07:40:32 檢舉
試過這樣打包嗎?
pyinstaller -F .\要打包的python檔.py

pyinstaller --onefile .\要打包的python檔.py
seaotter iT邦新手 2 級 ‧ 2023-04-25 09:55:10 檢舉
有 狀況一樣
ccutmis iT邦高手 2 級 ‧ 2023-04-25 11:57:50 檢舉
可以Try1:
https://www.dimonwise.top/python/51/
可以Try2:
向toga的開發者提交這個問題
可以Try3:
改用 別的 GUI 框架 例如 PyQt 或 PySide
seaotter iT邦新手 2 級 ‧ 2023-04-25 17:30:20 檢舉
Try1試過了,目前可能會考慮先去toga的github上弄一個issues,感謝你的回覆
arguskao iT邦新手 4 級 ‧ 2023-09-04 21:40:09 檢舉
應該是有模組需要pip 安裝,但打包沒有打包進去
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答