本文介绍了来自。 import _methods ImportError:无法在cx-freeze python中导入名称'_methods'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
exe
。但是当我执行 exe
文件时,它显示以下错误:
exe
build successfully by using cx-freeze. But it shows the following error when I execute the exe
file:
推荐答案
此问题已在此处得到解答:
但是为了完整性是针对此特定情况的答案:cx_freeze不会导入可选模块 _method ,因此您必须明确告诉他要这样做。
This question was already answer here: Why am I getting this ImportError?but for the sake of completeness here is the answer for this specific case: cx_freeze is not importing the optional module _method, so you have to tell him explicitly to do it.
additional_mods = ['numpy.core._methods', 'numpy.lib.format']
setup(name='xyz',
version='0.4',
description='xyz script',
options = {'build_exe': {'includes': additional_mods}},
executables = [Executable('xyz.py')]
)
在上面的代码中我还必须在 _methods 之后导入 format 。对我来说,这两个模块足够多了,可能您需要更多。
In the code above I have to import also format, after _methods. For me the 2 modules where enough, may be you need more.
这篇关于来自。 import _methods ImportError:无法在cx-freeze python中导入名称'_methods'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!