1

我目前正在研究 pyInstaller。我现在一直在使用 py2exe,但如果我只为我们所针对的所有平台使用一个编译器,那就太好了。我的 py2exe setup.py 看起来像这样:

from distutils.core import setup
import py2exe

setup(
    name='agent',
    description='Service Test',
    version='1.00.00',
    service=['agent'],
    console=['agent.py'],
    zipfile=None,
    options={ "py2exe":{
                    "includes":"win32service,win32serviceutil,win32event,servicemanager,autobahn",
                    "packages": 'twisted, autobahn',
                    'bundle_files': 1
                },
        },
)

我已经设法编译了 Windows 服务,但是一旦我开始使用 twisted,它就会失败。我用 pyInstaller 编译的命令行:

python PyInstaller.py --onefile c:\path\here\agent.py
python PyInstaller.py --hidden-import=twisted --onefile c:\path\here\agent.py

我尝试安装服务时遇到的错误

agent.exe?175104\twisted\python\modules.py:758: 
UserWarning: C:\dist\path\agent.exe?175104 (for module twisted.web.util) not in path importer cache (PEP 302 violation - check your local configuration).
4

0 回答 0