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

时间:2015-12-01 13:51:18

标签: python centos6 cx-freeze

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

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

然而,我立即得到另一个我不明白的错误。我找不到任何关于假定模块缺失的信息,也没有关于错误本身的信息,更不用说与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。但那并没有做任何事情。

提前谢谢!

1 个答案:

答案 0 :(得分:1)

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

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)])