在 运行 cx_freeze 构建 python 可执行文件时出现奇怪的 core_cy 模块导入错误

Strange core_cy module import error while running cx_freeze built python executable

我正在尝试将我的 Python 脚本导出到高性能集群 (运行ning CentOS 6),同时避免安装额外的 Python 软件包。我使用一个虚拟的 CentOS 6 环境,我在其中安装了所有必需的软件包,以使用 cx_freeze 创建一个可执行文件,然后我可以将其 运行 转移到集群中执行。

我 运行 遇到了 scipycx_freeze 的一些错误,我现在认为这些错误已经解决(感谢 Whosebug 上有关此主题的大量文档)。

然而,我立即得到另一个我不明白的错误。我找不到关于假定模块丢失的任何信息,也找不到关于错误本身的任何信息,更不用说结合 cx_freeze.

当我尝试 运行 可执行文件时生成以下错误:

ImportError: No module named core_cy

我使用文件中的以下 setup.py 使用 cx_freeze 构建可执行文件:

import sys
import scipy

from os import path

from cx_Freeze import setup, Executable

includefiles_list=[]
scipy_path = path.dirname(scipy.__file__)

includefiles_list.append(scipy_path)

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "include_files": includefiles_list}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None

setup(  name = "CD34Filter",
        version = "0.1",
        description = "CD34Filter Script",
        options = {"build_exe": build_exe_options},
        executables = [Executable("cd34_filter.py", base=base)])

我已经尝试将 "excludes": ["core_cy"] 选项添加到 build_exe_options。但这并没有做任何事情。

提前致谢!

经过一些额外的研究,我发现 core_cyskimage 模块的一个模块。我继续以与包含 scipy 相同的方式将 scikit-image 包含到包中。这解决了错误,现在我的可执行文件运行良好!希望这对其他人有用。

import sys
import scipy
import skimage

from os import path

from cx_Freeze import setup, Executable

includefiles_list=[]
scipy_path = path.dirname(scipy.__file__)
skimage_path = path.dirname(skimage.__file__)

includefiles_list.append(scipy_path)
includefiles_list.append(skimage_path)

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "include_files": includefiles_list}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None

setup(  name = "CD34Filter",
        version = "0.1",
        description = "CD34Filter Script",
        options = {"build_exe": build_exe_options},
        executables = [Executable("cd34_filter.py", base=base)])