python程序发布 方法二:py2exe FAQ

  1. 执行如下命令:

    python C:Python27Scriptscxfreeze main.py --target-dir dist --base-name Win32GUI --include-modules atexit
    

方法二:py2exe

  1. 编写setup.py

    from distutils.core import setup
    import py2exe
    
    options = { 'py2exe': { 'dll_excludes':['w9xpopen.exe']}}
    
    setup(options = options, windows = [{'script':'main.py'}])
    
  2. 执行如下命令:

    python setup.py py2exe
    

FAQ

  1. cxfreeze启动程序时提示错误。

    distPySideopenssl下的dll都复制到dist下即可。

  2. py2exe提示缺少msvcp90.dll文件。

    msvcp90.dll文件复制到setup.py所在目录即可。