2013-02-10 109 views
0

對不起,如果這是一個非常愚蠢的問題,
如何讓py2exe找到我想轉換的模塊?
我不斷收到此錯誤:py2exe找不到.py

C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'dist_dir' 
    warnings.warn(msg) 
running py2exe 
creating C:\Users\David\workspace\setup\src\dist 
*** searching for required modules *** 
error: Pygame.py: No such file or directory 

我擡頭一看盡可能多的對Pygame的教程.exe或問題有的都有了,但他們的問題似乎發生後,他們創造了一個.exe文件...
我可以甚至無法創建一個。
我使用的確切相同的代碼,所述一個上http://pygame.org/wiki/Pygame2exe發現不同的是我改變:

class BuildeExe: 
def __init__(self): 
    #Name of starting .py 
    self.script = "MyApps.py" 

class BuildExe: 
def __init__(self): 
    #Name of starting .py 
    self.script = "Pygame.py" 

我Pygame.py存在在 「C:\用戶\」 用戶名「\工作區\ pygame中的\ src」。請幫忙。

+0

這可能有所幫助。 http://www.pygame.org/wiki/Pygame2exe?parent=CookBook – ninMonkey 2013-02-10 13:30:42

+0

嗯......我相信是從我貼的鏈接有相同的代碼。我試過了,但沒有奏效。謝謝你^^ – 2013-02-13 00:49:03

回答

0

你可以嘗試把這個在一個.py文件:

from distutils.core import setup 
import py2exe 

setup(console=['hello.py']) 

比如他們在this教程怎麼做。然後,所有你需要做的就是oppen了CMD.EXE並cd到你的「C:\用戶\」用戶名「\工作區\ pygame中的\ src」,然後鍵入:

python setup.py py2exe 

,或者你可以改變setup.py到任何.py文件你保存上面的代碼英寸(在你給的同一目錄內)

+0

我相信這是爲了將普通的python程序轉換爲exe。因爲我試圖轉換的代碼使用pygame,我認爲它需要比您建議的代碼更復雜一點。我之前試過這段代碼,並給了我關於pygame使用方面的錯誤...... – 2013-02-13 00:47:06