0

抱歉,如果这是一个非常愚蠢的问题,
我如何让 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\"username"\workspace\pygame\src" 中。请帮忙。

4

1 回答 1

0

您可以尝试将其放入 .py 文件中:

from distutils.core import setup
import py2exe

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

例如他们在教程中的表现。然后你所要做的就是打开 cmd.exe 和 cd 到你的 "C:\Users\"username"\workspace\pygame\src" 并输入:

python setup.py py2exe

或者您可以将 setup.py 更改为您保存上述代码的任何 .py 文件。(在您提供的同一目录中)

于 2013-02-10T07:28:38.603 回答