【问题标题】:Error when trying to run an executable of a python file尝试运行 python 文件的可执行文件时出错
【发布时间】:2018-03-09 22:26:53
【问题描述】:
Fatal Python error: (pygame parachute) Segmentation Fault
Traceback (most recent call last):
     File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1150, in resource_exists
          return get_provider(package_or_requirement).has_resource(resource_name)
     File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1608, in has_resource
          return self.has(self.fn(self.module_path, resource_name))
     File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1663, in _has
          "Can't perform this operation for unregistered loader type"
NotImplementedError: Can't perform this operation for unregistered loader type

我将我制作的一个 python 游戏转换成一个可执行文件。然后我去安装游戏,然后去运行它。当我运行可执行文件(刚刚安装)时,它在 cmd 提示符中给出了该错误,然后说应用程序停止工作。实际游戏没有运行,它立即停止工作。

我使用 cx_Freeze 将其转换为可执行文件。我正在运行 Python 3.4 并安装了正确的 cx_Freeze。

【问题讨论】:

  • 您可能忘记在您的模块目录之一中包含__init__.py 文件
  • 那么我该怎么做才能解决这个问题? @wpercy

标签: python python-3.x pygame cx-freeze


【解决方案1】:

在我看到的此类错误的各种答案中。您的一个目录有一个 python 模块,但它不是一个包。因此,对于您在 cx_Freeze 中使用的任何内容,通过添加 __init__.py 文件将其转换为包。

【讨论】:

  • > "通过添加 init.py 文件将其转换为包"。你什么意思?我该怎么做?
  • 如果你有一个directory 里面有.py 文件。如果没有__init__.py 文件,请在该目录中添加一个空的__init__.py 文件。
  • 我在看什么目录?
  • 这些是你的文件。 I converted a python game I had made into an executable file.你的python游戏中你正在使用cx_Freeze转换的文件。
  • 我查过,他们都有__init__.py
猜你喜欢
  • 2012-07-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-20
  • 1970-01-01
相关资源
最近更新 更多