簡體   English   中英

Mac上的Pyinstaller:如何在不先打開終端的情況下打開應用程序?

[英]Pyinstaller on Mac: How to open app without opening terminal first?

所以我對 Pyinstaller 很陌生,並試圖創建一個可以在任何操作系統系統上運行而無需先打開終端的應用程序。 到目前為止,我已經下載了 Pyinstaller 並在終端中運行pyinstaller --onefile mainGUI.spec來生成 dist 和可執行文件。 我的規格文件如下:

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(['mainGUI.pyw', 'modules/methods.py'],
             pathex=['****'],
             binaries=None,
             datas=[('private_key/private_key.pem', '.')],
             hiddenimports=['numpy', 'pytz', 'dateutil', 'PyJWT', 'httplib2', 'Pysocks', 'json', 'time', 'openpyxl'],
             hookspath=None,
             runtime_hooks=None,
             excludes=None,
             win_no_prefer_redirects=None,
             win_private_assemblies=None,
             cipher=block_cipher)

def get_pandas_path():
    import pandas
    pandas_path = pandas.__path__[0]
    return pandas_path

dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
a.datas += dict_tree
a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)

pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='mainGUI',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False )

我在生成可執行文件時嘗試了 -w --noconsole 和 --windowed 標志,但都沒有奏效。 從我在文檔中閱讀的內容來看,這些似乎是要使用的標志。

提前感謝您的任何建議/幫助。

想通了,至少對我來說。 結果發現規范文件有些奇怪。 我剛剛刪除了那個並再次運行命令,新創建的命令完美運行!

希望這可以幫助一些人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM