启动内置的.exe文件时,将显示以下消息:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Program Files\Python37\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "Application.py", line 8, in <module>
from nats.aio.client import Client as NATS
File "C:\Program Files\Python37\lib\site-packages\nats\__init__.py", line 16, in <module>
from .aio.client import Client as NATS
File "C:\Program Files\Python37\lib\site-packages\nats\aio\client.py", line 18, in <module>
import ssl
File "C:\Program Files\Python37\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.
答案 0 :(得分:0)
python _ssl.pyd需要一些DLL,这些DLL需要使用
明确包含在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")]}
setup( name = "Application",
version = "0.1",
description = "Application",
options = {"build_exe": build_exe_options},
executables = [Executable("app.py", base=None)])