简体   繁体   English

py2exe中缺少模块

[英]Missing modules in py2exe

(First of all, sorry for my bad english, I'm not english). (首先,对不起我的英语不好,我不是英语)。

Yesterday I've finished my little program. 昨天我完成了我的小程序。 Today I've tried to compile that but appear that: prompt_image 今天,我试图编译,但出现的: prompt_image

This is the setup script: 这是安装脚本:

from distutils.core import setup
import py2exe

setup(console=['my_program.py'])

How can I solve this problem? 我怎么解决这个问题?

Thank you! 谢谢!

Try explicitly passing a py2exe option to your setup. 尝试将py2exe选项显式传递给您的设置。

I usually follow this general setup.py for a py2exe program. 对于py2exe程序,我通常遵循此常规setup.py。

from distutils.core import setup
import os
import shutil
import py2exe



data_files = []
setup(
    name='ApplicationName',
    console=['script_file.py'], # 'windows' means it's a GUI, 'console' It's a console program, 'service' a Windows' service, 'com_server' is for a COM server
    # You can add more and py2exe will compile them separately.
    options={ # This is the list of options each module has, for example py2exe, but for example, PyQt or django could also contain specific options
        'py2exe': {
            'packages': [],
            'dist_dir': 'dist', # The output folder
            'compressed': True, # If you want the program to be compressed to be as small as possible
            'includes': ['os', 'logging', 'yaml', 'sqlalchemy', 'pymysql'], # All the modules you need to be included, I added packages such as PySide and psutil but also custom ones like modules and utils inside it because py2exe guesses which modules are being used by the file we want to compile, but not the imports, so if you import something inside main.py which also imports something, it might break.
        }
    },

    data_files=data_files # Finally, pass the

)

Please reinstall py2exe; 请重新安装py2exe; maybe to a different version that supports Python 3.5 也许是支持Python 3.5的其他版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM