我正在尝试使用py2exe创建一个简单的exe。不幸的是,当我尝试创建一个简单的py2xe时,它失败了。
我的Python脚本是:
print("Hello World")
我的设置脚本是:
from distutils.core import setup
import py2exe
setup(console="mouse-check.py")
当我运行py py2exe-installer.py py2exe
时,我得到以下输出:
C:Users...Pythonpy2exe-installer.py:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup
running py2exe
error: [Errno 2] No such file or directory: 'm'
我在Windows上使用Python 3.10.4
。
我的py2xe版本是:0.11.1.1
我的目录结构是:
/Python
- py2exe-installer.py
- mouse-check.py
任何人都知道";m〃;是指这里吗?
setup
函数需要console
参数是列表,您可以在实现中阅读更多详细信息。或者这里的教程和示例。
你的设置脚本应该看起来像这个
from distutils.core import setup
import py2exe
setup(console=["mouse-check.py"])