Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python程序在使用pyinstaller后无法打开可执行文件_Python_Python 3.x_Windows_Pyinstaller_Exe - Fatal编程技术网

Python程序在使用pyinstaller后无法打开可执行文件

Python程序在使用pyinstaller后无法打开可执行文件,python,python-3.x,windows,pyinstaller,exe,Python,Python 3.x,Windows,Pyinstaller,Exe,我制作了一个相当简单的程序,可以打开一个exe文件。当我在VSCode中运行它时,它工作正常,但是当我使用pyinstaller将程序转换为exe时,程序将不再打开可执行文件 import os, time dir = os.path.dirname(__file__) pathname = os.path.join(dir, 'Updates') filename = os.path.join(dir, 'Updates','ProgramSetup.exe')

我制作了一个相当简单的程序,可以打开一个exe文件。当我在VSCode中运行它时,它工作正常,但是当我使用pyinstaller将程序转换为exe时,程序将不再打开可执行文件

import os, time

    dir = os.path.dirname(__file__)
    pathname = os.path.join(dir, 'Updates')
    filename = os.path.join(dir, 'Updates','ProgramSetup.exe')
    time.sleep(0.5) 
    os.chdir(pathname)
    os.system(filename)

我做错什么了吗?

请确保将此可执行文件放置在与原始python文件相同的位置,因为
dir
依赖于原始保存文件的路径我就是这样做的。它仍然不起作用。你收到什么错误消息了吗?没有。这根本没用。Cmd打开一秒钟,然后关闭。确保spec文件或pyinstaller命令的console=True,然后从命令行运行exe。阅读文档以了解何时出现问题