将有效的Python脚本转换为EXE后出现错误(Python)

时间:2018-10-23 13:24:16

标签: python exe pyinstaller

最近,我使用pygame制作了一个简单的游戏,它运行正常,没有错误。现在,我想将其转换为EXE。我使用pyinstaller进行了以下操作:pyinstaller --onefile dodge1.py

但是当我运行EXE时出现此错误,我不知道如何处理它,因为我是一个初学者,以前从未见过它:

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "dodge1.py", line 168, in <module>
  File "dodge1.py", line 97, in game_intro
  File "site-packages\pygame\pkgdata.py", line 50, in getResource
  File "site-packages\pkg_resources\__init__.py", line 1129, in resource_exists
  File "site-packages\pkg_resources\__init__.py", line 1399, in has_resource
  File "site-packages\pkg_resources\__init__.py", line 1452, in _has
NotImplementedError: Can't perform this operation for unregistered loader type
[5588] Failed to execute script dodge

1

这就是第168和97行,因为这些行似乎是有问题的行:

168:game_intro()
97:LargeText = pygame.font.Font('freesansbold.ttf', 70)

如果需要全部170行代码,请发表评论,我只是没有把这个问题弄得很长。

0 个答案:

没有答案