导入python exe文件
使用py2exe,我创建了一个包含我找到的指令的脚本的exe版本。该脚本编译得很好,并且每个脚本都生成一个dist和build文件夹,但是当我在命令行上运行该程序时,会出现此错误。注意:该脚本在我的IDE环境中运行良好,但我打算给同事提供exe版本。如何修复此错误导入python exe文件,python,Python,使用py2exe,我创建了一个包含我找到的指令的脚本的exe版本。该脚本编译得很好,并且每个脚本都生成一个dist和build文件夹,但是当我在命令行上运行该程序时,会出现此错误。注意:该脚本在我的IDE环境中运行良好,但我打算给同事提供exe版本。如何修复此错误 Traceback (most recent call last): File "tester2.py", line 4, in <module> ImportError: No module named mechan
Traceback (most recent call last):
File "tester2.py", line 4, in <module>
ImportError: No module named mechanize
您必须声明您的依赖项。 这是我的设置
setup(
executables=executables,
options=options,
name='bla',
version='0.3',
packages=[...],
url='',
license='',
author='',
author_email='',
description='', requires=['pandas', 'unidecode', 'click',
'xlsxwriter'] // you would have to add mechanize here
)
是否已将文件添加到生成中 请查看
setup.py
中的包含选项:
这里还有我对类似问题的解决方案,即如何添加文件以在以后生成和运行它们:
setup(
executables=executables,
options=options,
name='bla',
version='0.3',
packages=[...],
url='',
license='',
author='',
author_email='',
description='', requires=['pandas', 'unidecode', 'click',
'xlsxwriter'] // you would have to add mechanize here
)