如何使用cx_freeze冻结一些python测试?

问题描述 投票:2回答:1

我尝试使用cx_freeze冻结测试代码,但出现以下运行时错误:

  ...
    __version__ = version(__name__)
  File "C:\Python36-32\lib\site-packages\importlib_metadata\__init__.py", line 457, in version
    return distribution(package).version
  File "C:\Python36-32\lib\site-packages\importlib_metadata\__init__.py", line 430, in distribution
    return Distribution.from_name(package)
  File "C:\Python36-32\lib\site-packages\importlib_metadata\__init__.py", line 184, in from_name
    raise PackageNotFoundError(name)
importlib_metadata.PackageNotFoundError: importlib_metadata

这是我的setup.py脚本:

from cx_Freeze import setup, Executable
import pytest

build_exe_options = {"includes":  pytest.freeze_includes() }

setup(
    name = "runtests",
    version = "0.1",
    description = "runtests",
    executables = [Executable("runtest.py")],
    options = {"build_exe": build_exe_options},
)
python pytest cx-freeze
1个回答
0
投票

我今天正在处理这个确切的问题-看起来问题是由Python <= 3.7.x和Python> = 3.8.x之间的命名方案更改引起的以我为例,强迫系统使用3.8解释器可以解决问题,但是根据您的设置,可能是相反的方式。

这是引导我进入的职位:https://github.com/python-poetry/poetry/issues/1487

© www.soinside.com 2019 - 2024. All rights reserved.