Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
导入python exe文件_Python - Fatal编程技术网

导入python 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

使用py2exe,我创建了一个包含我找到的指令的脚本的exe版本。该脚本编译得很好,并且每个脚本都生成一个dist和build文件夹,但是当我在命令行上运行该程序时,会出现此错误。注意:该脚本在我的IDE环境中运行良好,但我打算给同事提供exe版本。如何修复此错误

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
)