Python-通过pyinstaler生成exe的python可以正常工作,但程序EXE无法正常工作

时间:2020-05-12 16:22:36

标签: python python-3.x windows exe pyinstaller

我想通过pyinstaller生成此脚本,但是.EXE为什么不起作用?

这是来自Github的完整代码:https://github.com/blourabie/b

这是setup.py代码:

from setuptools import setup

APP = ["main.py"]
APP_NAME = "TEST"
APP_VERSION = "0.0.1"
DATA_FILES = ["lib", "data", "components", "pages"]
OPTIONS = {
    "argv_emulation": True,
    "iconfile": "data/image/128.icns",
    "plist": {
        "CFBundleName": APP_NAME,
        "CFBundleDisplayName": APP_NAME,
        "CFBundleGetInfoString": "doudoudzj",
        "CFBundleIdentifier": "com.crogram.osx.application",
        "CFBundleVersion": APP_VERSION,
        "CFBundleShortVersionString": APP_VERSION,
        "NSHumanReadableCopyright": "Copyright © 2018, Crogram, Inc., All Rights Reserved",
    },
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={"pyinstaller": OPTIONS},
    setup_requires=["pyinstaller"],
)

我通过代码pyinstaller --onefile -w setup.py

生成它

生成工作正常,但是从CMD运行应用程序setup.exe后,我看到错误消息:

PS C:\Users\JOHN\Desktop\T\tkinter-gui-application-examples-master\dist> setup.exe
setup.exe : The term 'setup.exe' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ setup.exe
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (setup.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command setup.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\setup.exe". See "get-help about_Command_Precedence" for more details.

运行应用程序后,我看到此屏幕:

enter image description here

0 个答案:

没有答案