尝试使用导入脚本创建 exe 文件 pygame
Trying to create exe file from with a script importing pygame
这是我在 运行 我的 space-invaders 游戏的 exe 文件之后得到的,即使 dist 文件夹中的 assets 文件夹也是如此。用于创建 exe 的命令是:pyinstaller spaceinvaders.py --onefile --noconsole
image of error
来自文档。
Helping PyInstaller Find Modules
Extending the Path If Analysis
recognizes that a module is needed, but cannot find that module, it is
often because the script is manipulating sys.path. The easiest thing
to do in this case is to use the --paths option to list all the other
places that the script might be searching for imports:
pyi-makespec --paths=/path/to/thisdir
--paths=/path/to/otherdir myscript.py
These paths will be noted in the spec file in the pathex argument. They will be added to
the current sys.path during analysis.
尝试添加该模块的路径,看看它是否能正常工作。
这是我在 运行 我的 space-invaders 游戏的 exe 文件之后得到的,即使 dist 文件夹中的 assets 文件夹也是如此。用于创建 exe 的命令是:pyinstaller spaceinvaders.py --onefile --noconsole
image of error
来自文档。
Helping PyInstaller Find Modules
Extending the Path If Analysis recognizes that a module is needed, but cannot find that module, it is often because the script is manipulating sys.path. The easiest thing to do in this case is to use the --paths option to list all the other places that the script might be searching for imports:
pyi-makespec --paths=/path/to/thisdir
--paths=/path/to/otherdir myscript.pyThese paths will be noted in the spec file in the pathex argument. They will be added to the current sys.path during analysis.
尝试添加该模块的路径,看看它是否能正常工作。