簡體   English   中英

py2exe找不到.py

[英]py2exe can't find .py

抱歉,如果這是一個非常愚蠢的問題,
如何獲取py2exe來查找我想要轉換的模塊?
我不斷收到此錯誤:

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:\\ Users \\”用戶名“ \\ workspace \\ pygame \\ src”中。 請幫忙。

您可以嘗試將其放入.py文件中:

from distutils.core import setup
import py2exe

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

例如他們在教程中的操作方式。 然后,您要做的就是將cmd.exe和cd掛接到“ C:\\ Users \\”用戶名“ \\ workspace \\ pygame \\ src”並鍵入:

python setup.py py2exe

或者,您也可以將setup.py更改為將上面的代碼保存到的任何.py文件。(與您輸入的目錄位於同一目錄中)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM