因此,我正在开发一个PySide应用程序(适用于Python的Qt),我想使用cx_freeze将其冻结。
当我使用下面的安装文件运行python setup.py build
时,它将创建没有错误的生成目录,但是当我运行生成的.exe文件时,会收到以下错误消息:
from cx_Freeze import setup, Executable
target = Executable(
script="main_window.py",
base = "Win32GUI",
icon="images\\icon.ico"
)
setup(name = "DemiurgoXMLgen" ,
version = "0.1" ,
description = "" ,
options={'build_exe': {'include_files': ['images\\']}},
executables = [target])
我认为这与我在应用程序中使用的 Paramiko 软件包有关。有没有人遇到并解决过这个问题?
答案 0 :(得分:0)
我认为我是通过如下修改setup.py
来解决此问题的:
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
build_exe_options = {"include_files" : [
os.path.join(PYTHON_INSTALL_DIR, "DLLs", "libcrypto-1_1-x64.dll"),
os.path.join(PYTHON_INSTALL_DIR, "DLLs", "libssl-1_1-x64.dll")]}
build_exe_options = {"packages": ['cffi', 'cryptography'], 'include_files': ['images\\', os.path.join(PYTHON_INSTALL_DIR, "DLLs", "libcrypto-1_1-x64.dll"),
os.path.join(PYTHON_INSTALL_DIR, "DLLs", "libssl-1_1-x64.dll")]}
target = Executable(
script="main_window.py",
base = "Win32GUI",
icon="images\\icon.ico"
)
setup(name = "DemiurgoXMLgen" ,
version = "0.1" ,
description = "" ,
options={'build_exe': build_exe_options},
executables = [target])
并在paramiko->ed25519key.py
中修改导入:
导入default_backend
from cryptography.hazmat.backends import openssl as openssl_backend
本质上:
cffi
中明确指定cryptography
和build_exe_options
的导入libcrypto-1_1-x64.dl
l和libssl-1_1-x64.dll
的 dlls openssl_backend
而不是default_backend