cx_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

cx_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

我正在努力尝试在 Windows 10 上生成 python 可执行文件。我已经尝试了 中提出的解决方案和许多变体,但仍然出现错误。

我的setup.py:

from cx_Freeze import setup, Executable

additional_mods = ["numpy", "pandas", "spacy"]
# Dependencies are automatically detected, but it might need
# fine tuning.
# buildOptions = dict(packages=[], excludes=[], includes=additional_mods)
buildOptions = dict(packages=additional_mods, excludes=[])

base = "Console"

executables = [Executable("app.py", base=base)]


setup(
    name="bpo",
    version="1.0",
    description="",
    options=dict(build_exe=buildOptions),
    executables=executables,
)

会发生什么? mkl 已安装,我已将其内容复制到 lib 路径作为建议的答案。

我也曾尝试将所有这些变量设置为 1,如 anaconda 文档的 Troubleshooting section 所指定,但不幸的是:

    CONDA_DLL_SEARCH_MODIFICATION_ENABLE
    CONDA_DLL_SEARCH_MODIFICATION_DEBUG
    CONDA_DLL_SEARCH_MODIFICATION_NEVER_ADD_WINDOWS_DIRECTORY
    CONDA_DLL_SEARCH_MODIFICATION_NEVER_ADD_CWD

尝试将 mkl_* 依赖项复制到 build 目录本身而不是 build/lib

您可以使用 build_exe 选项的 include_files 列表让 cx_Freeze 包含必要的文件。