1

我正在尝试使用 Pyinstaller 将 python 文件转换为可执行文件。该文件调用不同的模块以及不同的库。执行命令时,pyinstaller --onefile instabot.py会生成一个 instabot.exe 文件并按预期放置到 dict 文件夹中。 但是,当我尝试运行此类文件时,它会打开终端一秒钟,然后立即关闭它。 我尝试将 .exe 文件留在 dict 文件夹中,以及将其移动到顶级文件夹中,但没有任何效果。即使将 .exe 文件放在与原始 instabot.py 文件相同的级别(因此可以访问所有使用的模块和库),它的行为仍然相同......我也尝试删除 --onefile 选项,但是结果是一样的。

我在 Windows 10 机器上运行该命令。Pyinstaller 是最新版本(我用过pip install -U pyinstaller

不幸的是,我没有更多关于为什么会出现这个问题的意见......

要复制我面临的问题,您可以关闭此处链接的 git 存储库:https ://github.com/davidwickerhf/desktop-instabot 然后,在虚拟环境中,将模块安装在 requirements.txt 文件中(pip install -r requirements

任何帮助、建议或问题将不胜感激。

如果需要任何进一步的信息,我很乐意提供 - 我目前不确定我可以提供哪些更有用的信息。

编辑 2 当我运行命令pyinstaller --windowed --onefile --debug=all instabot.py时,打开 .exe 文件时,我收到错误消息 = 'Failed to execute script pyiboot01_bootstrap'

编辑 1 我运行了命令pyinstaller instabot.py --debug=imports,在执行输出 .exe(在 dist 文件夹内,从终端)时,我收到以下消息:

import _frozen_importlib # frozen
import _imp # builtin
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
import 'nt' # <class '_frozen_importlib.BuiltinImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'winreg' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'time' # <class '_frozen_importlib.BuiltinImporter'>
import 'zipimport' # <class '_frozen_importlib.FrozenImporter'>
# installed zipimport hook
# zipimport: found 147 names in 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\base_library.zip'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import codecs # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\codecs.pyc
import encodings.aliases # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\encodings\aliases.pyc
import encodings # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\encodings\__init__.pyc
import encodings.utf_8 # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\encodings\utf_8.pyc
import encodings.cp1252 # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\encodings\cp1252.pyc
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
import encodings.latin_1 # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\encodings\latin_1.pyc
import '_abc' # <class '_frozen_importlib.BuiltinImporter'>
import abc # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\abc.pyc
import io # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\io.pyc
import '_struct' # <class '_frozen_importlib.BuiltinImporter'>
import 'zlib' # <class '_frozen_importlib.BuiltinImporter'>
# PyInstaller: FrozenImporter(D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\instabot.exe?288734)
import os # PyInstaller PYZ
import stat # PyInstaller PYZ
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
# _collections_abc not found in PYZ
import _collections_abc # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\_collections_abc.pyc
import ntpath # PyInstaller PYZ
import genericpath # PyInstaller PYZ
import 'genericpath' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'ntpath' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'os' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import ctypes # PyInstaller PYZ
# types not found in PYZ
import types # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\types.pyc
# _ctypes not found in PYZ
# extension module '_ctypes' loaded from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_ctypes.pyd'
# extension module '_ctypes' executed from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_ctypes.pyd'
import '_ctypes' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000230F317DB50>
import ctypes._endian # PyInstaller PYZ
import 'ctypes._endian' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'ctypes' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
# re not found in PYZ
# enum not found in PYZ
import enum # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\enum.pyc
# sre_compile not found in PYZ
import '_sre' # <class '_frozen_importlib.BuiltinImporter'>
# sre_parse not found in PYZ
# sre_constants not found in PYZ
import sre_constants # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\sre_constants.pyc
import sre_parse # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\sre_parse.pyc
import sre_compile # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\sre_compile.pyc
# functools not found in PYZ
# collections not found in PYZ
# heapq not found in PYZ
import '_heapq' # <class '_frozen_importlib.BuiltinImporter'>
import heapq # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\heapq.pyc
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# keyword not found in PYZ
import keyword # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\keyword.pyc
# operator not found in PYZ
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
import operator # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\operator.pyc
# reprlib not found in PYZ
import reprlib # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\reprlib.pyc
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import collections # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\collections\__init__.pyc
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
import functools # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\functools.pyc
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
# copyreg not found in PYZ
import copyreg # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\copyreg.pyc
import re # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\re.pyc
import multiprocessing # PyInstaller PYZ
import multiprocessing.context # PyInstaller PYZ
import threading # PyInstaller PYZ
# _weakrefset not found in PYZ
import _weakrefset # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\_weakrefset.pyc
import 'threading' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import multiprocessing.process # PyInstaller PYZ
import signal # PyInstaller PYZ
import 'signal' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'multiprocessing.process' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import multiprocessing.reduction # PyInstaller PYZ
import pickle # PyInstaller PYZ
import _compat_pickle # PyInstaller PYZ
import '_compat_pickle' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import '_pickle' # <class '_frozen_importlib.BuiltinImporter'>
# org not found in PYZ
import 'pickle' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import socket # PyInstaller PYZ
# _socket not found in PYZ
# extension module '_socket' loaded from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_socket.pyd'
# extension module '_socket' executed from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_socket.pyd'
import '_socket' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000230F4C46760>
import selectors # PyInstaller PYZ
# collections.abc not found in PYZ
import collections.abc # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\collections\abc.pyc
import 'math' # <class '_frozen_importlib.BuiltinImporter'>
# select not found in PYZ
# extension module 'select' loaded from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\select.pyd'
# extension module 'select' executed from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\select.pyd'
import 'select' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000230F4C54DF0>
import 'selectors' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'errno' # <class '_frozen_importlib.BuiltinImporter'>
import 'socket' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import '_winapi' # <class '_frozen_importlib.BuiltinImporter'>
import 'multiprocessing.reduction' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'multiprocessing.context' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'multiprocessing' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import multiprocessing.spawn # PyInstaller PYZ
import runpy # PyInstaller PYZ
import importlib # PyInstaller PYZ
# warnings not found in PYZ
import warnings # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\warnings.pyc
import 'importlib' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import importlib.machinery # PyInstaller PYZ
import 'importlib.machinery' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import importlib.util # PyInstaller PYZ
import importlib.abc # PyInstaller PYZ
import typing # PyInstaller PYZ
import contextlib # PyInstaller PYZ
import 'contextlib' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'typing' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'importlib.abc' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'importlib.util' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import pkgutil # PyInstaller PYZ
# weakref not found in PYZ
import weakref # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\weakref.pyc
import 'pkgutil' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'runpy' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import multiprocessing.util # PyInstaller PYZ
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
import subprocess # PyInstaller PYZ
# pwd not found in PYZ
# grp not found in PYZ
import 'msvcrt' # <class '_frozen_importlib.BuiltinImporter'>
import 'subprocess' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'multiprocessing.util' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'multiprocessing.spawn' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import multiprocessing.popen_spawn_win32 # PyInstaller PYZ
import 'multiprocessing.popen_spawn_win32' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import ssl # PyInstaller PYZ
# _ssl not found in PYZ
# extension module '_ssl' loaded from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_ssl.pyd'
# extension module '_ssl' executed from 'D:\\dhfwi\\Projects\\wickerdevs\\instabot\\desktop-instabot\\dist\\instabot\\_ssl.pyd'
import '_ssl' # <_frozen_importlib_external.ExtensionFileLoader object at 0x00000230F4F526A0>
import base64 # PyInstaller PYZ
import 'binascii' # <class '_frozen_importlib.BuiltinImporter'>
import 'base64' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'ssl' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import logging # PyInstaller PYZ
# traceback not found in PYZ
# linecache not found in PYZ
import tokenize # PyInstaller PYZ
import token # PyInstaller PYZ
import 'token' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'tokenize' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import linecache # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\linecache.pyc
import traceback # loaded from Zip D:\dhfwi\Projects\wickerdevs\instabot\desktop-instabot\dist\instabot\base_library.zip\traceback.pyc
import string # PyInstaller PYZ
import '_string' # <class '_frozen_importlib.BuiltinImporter'>
import 'string' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
import 'logging' # <pyimod03_importers.FrozenImporter object at 0x00000230F3104190>
# clear builtins._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.__interactivehook__
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup[2] removing sys
# cleanup[2] removing builtins
# cleanup[2] removing _frozen_importlib
# cleanup[2] removing _imp
# cleanup[2] removing _thread
# cleanup[2] removing _warnings
# cleanup[2] removing _weakref
# cleanup[2] removing _frozen_importlib_external
# cleanup[2] removing nt
# cleanup[2] removing _io
# cleanup[2] removing marshal
# cleanup[2] removing winreg
# cleanup[2] removing time
# cleanup[2] removing zipimport
# cleanup[2] removing _codecs
# cleanup[2] removing codecs
# cleanup[2] removing encodings.aliases
# cleanup[2] removing encodings
# cleanup[2] removing encodings.utf_8
# cleanup[2] removing encodings.cp1252
# cleanup[2] removing _signal
# cleanup[2] removing encodings.latin_1
# cleanup[2] removing _abc
# cleanup[2] removing abc
# cleanup[2] removing io
# cleanup[2] removing __main__
# cleanup[2] removing struct
# cleanup[2] removing _struct
# cleanup[2] removing pyimod01_os_path
# cleanup[2] removing pyimod02_archive
# cleanup[2] removing zlib
# cleanup[2] removing pyimod03_importers
# cleanup[2] removing _stat
# cleanup[2] removing stat
# cleanup[2] removing _collections_abc
# cleanup[2] removing genericpath
# cleanup[2] removing ntpath
# cleanup[2] removing os.path
# cleanup[2] removing os
# cleanup[2] removing types
# cleanup[2] removing _ctypes
# cleanup[2] removing ctypes._endian
# cleanup[2] removing ctypes
# cleanup[2] removing enum
# cleanup[2] removing _sre
# cleanup[2] removing sre_constants
# destroy sre_constants
# cleanup[2] removing sre_parse
# cleanup[2] removing sre_compile
# cleanup[2] removing _heapq
# cleanup[2] removing heapq
# cleanup[2] removing itertools
# cleanup[2] removing keyword
# destroy keyword
# cleanup[2] removing _operator
# cleanup[2] removing operator
# cleanup[2] removing reprlib
# destroy reprlib
# cleanup[2] removing _collections
# cleanup[2] removing collections
# cleanup[2] removing _functools
# cleanup[2] removing functools
# cleanup[2] removing _locale
# cleanup[2] removing copyreg
# cleanup[2] removing re
# cleanup[2] removing _weakrefset
# destroy _weakrefset
# cleanup[2] removing threading
# cleanup[2] removing signal
# cleanup[2] removing multiprocessing.process
# cleanup[2] removing _compat_pickle
# cleanup[2] removing _pickle
# cleanup[2] removing pickle
# cleanup[2] removing _socket
# cleanup[2] removing collections.abc
# cleanup[2] removing math
# cleanup[2] removing select
# cleanup[2] removing selectors
# cleanup[2] removing errno
# cleanup[2] removing socket
# cleanup[2] removing _winapi
# cleanup[2] removing multiprocessing.reduction
# cleanup[2] removing multiprocessing.context
# cleanup[2] removing __mp_main__
# destroy __main__
# cleanup[2] removing multiprocessing
# cleanup[2] removing importlib._bootstrap
# cleanup[2] removing importlib._bootstrap_external
# cleanup[2] removing warnings
# cleanup[2] removing importlib
# cleanup[2] removing importlib.machinery
# cleanup[2] removing contextlib
# cleanup[2] removing typing
# destroy typing
# cleanup[2] removing importlib.abc
# cleanup[2] removing importlib.util
# cleanup[2] removing weakref
# cleanup[2] removing pkgutil
# destroy pkgutil
# cleanup[2] removing runpy
# cleanup[2] removing atexit
# cleanup[2] removing msvcrt
# cleanup[2] removing subprocess
# destroy subprocess
# cleanup[2] removing multiprocessing.util
# cleanup[2] removing multiprocessing.spawn
# cleanup[2] removing multiprocessing.popen_spawn_win32
# cleanup[2] removing _ssl
# cleanup[2] removing binascii
# cleanup[2] removing base64
# cleanup[2] removing ssl
# cleanup[2] removing token
# destroy token
# cleanup[2] removing tokenize
# cleanup[2] removing linecache
# cleanup[2] removing traceback
# cleanup[2] removing _string
# cleanup[2] removing string
# destroy string
# cleanup[2] removing logging
# cleanup[3] wiping logging
# destroy traceback
# cleanup[3] wiping _string
# cleanup[3] wiping linecache
# destroy tokenize
# cleanup[3] wiping ssl
# destroy base64
# cleanup[3] wiping binascii
# cleanup[3] wiping _ssl
# cleanup[3] wiping multiprocessing.popen_spawn_win32
# cleanup[3] wiping multiprocessing.spawn
# destroy runpy
# cleanup[3] wiping multiprocessing.util
# destroy weakref
# cleanup[3] wiping msvcrt
# cleanup[3] wiping atexit
# destroy atexit
# cleanup[3] wiping importlib.util
# cleanup[3] wiping importlib.abc
# cleanup[3] wiping contextlib
# cleanup[3] wiping importlib.machinery
# cleanup[3] wiping importlib
# destroy importlib.machinery
# destroy importlib.abc
# destroy importlib.util
# cleanup[3] wiping warnings
# cleanup[3] wiping importlib._bootstrap_external
# cleanup[3] wiping importlib._bootstrap
# cleanup[3] wiping multiprocessing
# destroy multiprocessing.util
# cleanup[3] wiping multiprocessing.context
# destroy multiprocessing.process
# destroy multiprocessing.reduction
# cleanup[3] wiping _winapi
# cleanup[3] wiping socket
# destroy selectors
# cleanup[3] wiping errno
# cleanup[3] wiping select
# cleanup[3] wiping math
# cleanup[3] wiping collections.abc
# cleanup[3] wiping _socket
# cleanup[3] wiping pickle
# destroy _compat_pickle
# cleanup[3] wiping _pickle
# cleanup[3] wiping signal
# cleanup[3] wiping threading
# cleanup[3] wiping re
# destroy enum
# destroy sre_compile
# cleanup[3] wiping copyreg
# cleanup[3] wiping _locale
# destroy _locale
# cleanup[3] wiping functools
# cleanup[3] wiping _functools
# destroy _functools
# cleanup[3] wiping collections
# destroy heapq
# destroy collections.abc
# cleanup[3] wiping _collections
# destroy _collections
# cleanup[3] wiping operator
# cleanup[3] wiping _operator
# destroy _operator
# cleanup[3] wiping itertools
# cleanup[3] wiping _heapq
# cleanup[3] wiping sre_parse
# cleanup[3] wiping _sre
# cleanup[3] wiping ctypes
# destroy ctypes._endian
# cleanup[3] wiping _ctypes
# cleanup[3] wiping types
# cleanup[3] wiping os
# destroy ntpath
# cleanup[3] wiping genericpath
# cleanup[3] wiping _collections_abc
# cleanup[3] wiping stat
# cleanup[3] wiping _stat
# destroy _stat
# cleanup[3] wiping pyimod03_importers
# cleanup[3] wiping zlib
# cleanup[3] wiping pyimod02_archive
# cleanup[3] wiping pyimod01_os_path
# cleanup[3] wiping _struct
# cleanup[3] wiping struct
# cleanup[3] wiping io
# destroy abc
# cleanup[3] wiping _abc
# cleanup[3] wiping encodings.latin_1
# cleanup[3] wiping _signal
# cleanup[3] wiping encodings.cp1252
# cleanup[3] wiping encodings.utf_8
# cleanup[3] wiping encodings
# destroy codecs
# destroy encodings.aliases
# destroy encodings.utf_8
# destroy encodings.cp1252
# destroy encodings.latin_1
# cleanup[3] wiping _codecs
# cleanup[3] wiping zipimport
# destroy _frozen_importlib_external
# cleanup[3] wiping time
# cleanup[3] wiping winreg
# cleanup[3] wiping marshal
# cleanup[3] wiping _io
# cleanup[3] wiping nt
# cleanup[3] wiping _weakref
# cleanup[3] wiping _warnings
# cleanup[3] wiping _thread
# cleanup[3] wiping _imp
# destroy _imp
# cleanup[3] wiping _frozen_importlib
# cleanup[3] wiping sys
# cleanup[3] wiping builtins
# destroy _ssl
# destroy _socket
# destroy zlib
# destroy _struct
# destroy _signal
# destroy winreg
# destroy stat
# destroy genericpath
# destroy encodings
# destroy ctypes
# destroy multiprocessing
# destroy multiprocessing.spawn
# destroy multiprocessing.popen_spawn_win32
# destroy ssl
# destroy logging
# destroy _sre
# destroy sre_parse
# destroy _abc
# destroy errno
# destroy msvcrt
# destroy _thread
# destroy _warnings
# destroy time
# destroy signal
# destroy threading
# destroy copyreg
# destroy pickle
# destroy socket
# destroy multiprocessing.context
# destroy _winapi
# destroy io
# destroy binascii
# destroy linecache
# destroy _weakref
# destroy _collections_abc
# destroy _heapq
# destroy _pickle
# destroy nt
# destroy importlib
# destroy os
# destroy warnings
# destroy zipimport
# destroy math
# destroy select
# destroy _string
# destroy io
# destroy itertools
# destroy collections
# destroy contextlib
# destroy functools
# destroy operator
# destroy re
# destroy types
# destroy _frozen_importlib
# clear sys.audit hooks
4

1 回答 1

0

我能够找到解决方案。对我来说编译我的 python 窗口 Tkinter 应用程序的命令是这样的:

对于生产:

pyinstaller run.py --onefile --windowed --noconsole --icon "instabot-config\instaclient.ico" --name instabot --add-data "instabot-config\instaclient.ico;." --add-data "instabot-config\botstate.json;." --add-data "instabot-config\instabot.log;." --clean

我相信我只需要确保添加正确的文件。

用于测试(这可能对每个想了解可执行文件未启动或无法正常运行的人更有帮助):

pyinstaller run.py --onefile --debug=all --add-data "\instabot-config\instaclient.ico;." --add-data "instabot-config\botstate.json;." --add-data "instabot-config\instabot.log;." --clean 
于 2021-03-23T21:31:41.623 回答