3

我正在尝试创建扭曲项目的 Windows 服务。windows 服务作为一个整体在 python 上有效,但是当我将它转换为 py2exe 时。

我已经尝试过这些 链接 1 链接 2 链接 3

但似乎没有任何效果。

from distutils.core import setup
import py2exe
import clinet_service

setup(
  options = {
    'py2exe': {
        "compressed": 1,
        'optimize': 2, 
        "packages": ["email","twisted","twisted.web.resource"],
        'bundle_files': 1,
        'includes' : ["win32com", "zope.interface"],
        "excludes": ["MySQLdb", "Tkconstants", "Tkinter","tcl","orm.adapters.pgsql","orm.adapters.mysql"],
        "dll_excludes": ["tcl84.dll", "tk84.dll","wxmsw26uh_vc.dll"]            
    }
},    
console=["clinet_service.py"],
zipfile = None    

)

这是输出:

 The following modules appear to be missing
 ['CFNetwork', 'Carbon', 'Carbon.Files', 'CoreFoundation', 'Crypto', 'Crypto.Cip
 er', 'Crypto.Cipher.AES', 'Crypto.Cipher.DES3', 'Crypto.Cipher.XOR', 'Crypto.Pu
 licKey', 'Cython.Distutils', 'OpenSSL', 'OpenSSL.SSL', 'OpenSSL.crypto', 'PAM',
'SOAPpy', '_curses', '_scproxy', 'crypt', 'dummy.plugins', 'email.Charset', 'em
il.Encoders', 'email.Errors', 'email.Generator', 'email.Header', 'email.Iterato
s', 'email.MIMEAudio', 'email.MIMEBase', 'email.MIMEImage', 'email.MIMEMessage'
'email.MIMEMultipart', 'email.MIMEText', 'email.Message', 'email.Parser', 'ema
l.Utils', 'email.base64MIME', 'email.quopriMIME', 'eunuchs.tuntap', 'gadfly', '
i.pygtkcompat', 'gi.repository', 'gmpy', 'gnome', 'gobject', 'goodpackage', 'gt
', 'gtk.glade', 'html', 'idonotexist', 'importlib.invalidate_caches', 'kinterba
db', 'mypackage', 'mypackage.testplugin', 'package', 'plugindummy.plugins', 'po
tmap', 'psycopg', 'pyPgSQL', 'pyasn1', 'pyasn1.codec.ber', 'pyasn1.type', 'pydo
tor.driver', 'pygtk', 'pyui', 'queue', 'quixote', 'resource', 'serial', 'shadow
, 'sitecustomize', 'spwd', 'sqlite', 'subunit', 'syslog', 'twisted.plugins.fake
ndpoint', 'twisted.python._epoll', 'twisted.python._initgroups', 'twisted.pytho
.sendmsg', 'twisted_private_helper', 'twisted_python_versions_package', 'twiste
_rebuild_fakelib', 'twisted_renamed_helper', 'uberpackage', 'urllib.parse', 'us
rcustomize', 'utmp', 'win32com.gen_py', 'win32com.shell', 'wx', 'wxPython.wx']

我在这里想念什么?

- - - - - - - 编辑

我已经找到了解决方案,我已经重新编写了这个脚本并进行了一些更改,这是我的脚本。Py2exe 只有在 site-packages/zope 中的init .py之后才成功。这是我的脚本。

  from distutils.core import setup
  import py2exe

  class BinaryDetails:

  def __init__(self, **kw):

    # for the versioninfo resources

    self.__dict__.update(kw)
    self.version = "1.1"
    self.company_name = "myworld"
    self.copyright = "myrights"
    self.name = "someprgms"    

    binary_service = BinaryDetails(
                            description = 'description',
                            includes = [],
                            modules = ['myservice'],
                            cmdline_style='pywin32'
                            )

    setup(
         options = {
                'py2exe': {
                            "compressed": 1,
                            'optimize': 2, 
                            "packages": ["email","twisted"],
                            'bundle_files': 1,
                            'includes' : ['lxml._elementpath','zope.interface'],
                            "excludes": ["MySQLdb", "Tkconstants", "Tkinter","tcl","orm.adapters.pgsql","orm.adapters.mysql"],
                            "dll_excludes": ["tcl84.dll", "tk84.dll","wxmsw26uh_vc.dll"]            
                            }
                },
    console = ["myservice.py"],
    zipfile = None,
    service=[binary_service]

   )  
4

0 回答 0