2014-01-29 142 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