2014-01-29 87 views
2

第一次使用stackoverflow所以请容易。我之前在我的旧电脑上使用过py2exe,并且工作正常。不幸的是,当试图使用它在我的新的EXE。文件不起作用。尝试转换.py文件时出现这些错误。py2exe - “以下模块似乎缺少”

我设置的.py

from distutils.core import setup 
import py2exe 

setup(windows=['Test.py']) 

我Test.py转换为EXE。

def Test(): 
    print 'TEST' 
    Test() 

的错误我收到:

The following modules appear to be missing 

['IronPythonConsole', 'System', 'System.Windows.Forms.Clipboard', '_scproxy', 'c 
lr', 'console', 'modes.editingmodes', 'pyreadline.keysyms.make_KeyPress', 'pyrea 
dline.keysyms.make_KeyPress_from_keydescr', 'pyreadline.keysyms.make_keyinfo', ' 
pyreadline.keysyms.make_keysym', 'startup'] 

*** binary dependencies *** 
Your executable(s) also depend on these dlls which are not included, 
you may or may not need to distribute them. 

Make sure you have the license if you distribute any of them, and 
make sure you don't distribute files belonging to the operating system. 

    OLEAUT32.dll - C:\WINDOWS\system32\OLEAUT32.dll 
    USER32.dll - C:\WINDOWS\system32\USER32.dll 
    SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll 
    KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll 
    ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll 
    WS2_32.dll - C:\WINDOWS\system32\WS2_32.dll 
    GDI32.dll - C:\WINDOWS\system32\GDI32.dll 
    VERSION.dll - C:\WINDOWS\system32\VERSION.dll 
    ole32.dll - C:\WINDOWS\system32\ole32.dll 

任何想法?我刚刚放弃在网上寻找,因为我似乎找不到任何问题的答案。我会很感激一些帮助。

+0

我只是运行相同的代码,它没有给任何缺少模块错误。什么尝试重新安装py2exe。 – TheCreator232

回答

0

我认为问题在于您正在使用窗口选项而不是控制台应用程序的控制台选项。对于任何进一步的问题py2exe你可以参考这Link

使用此代码来构建您的.exe:

from distutils.core import setup 
import py2exe 

setup(console=['Test.py']) 
+0

打印相同的错误,虽然当我点击Test.exe时弹出,然后马上关闭。 –

+1

@Alex:从控制台运行程序。它打开和关闭,因为这个应用程序没有GUI。但是如果你在控制台上运行它,它会打印'TEST'。 – TheCreator232