gpt4 book ai didi

python - pyinstaller 错误 - AttributeError : module 'pytest' has no attribute 'freeze_includes'

转载 作者:太空宇宙 更新时间:2023-11-03 14:49:22 24 4
gpt4 key购买 nike

我想将我的 python 文件转换为 exe 文件,但出现错误。我在 cmd 屏幕中点击了 pyinstaller -w file.py,然后我收到如下错误。

    Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python36\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "C:\Python36\lib\site-packages\PyInstaller\__main__.py", line 92, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Python36\lib\site-packages\PyInstaller\__main__.py", line 46, in run_
build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line
791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "C:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line
737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "C:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line
213, in __init__
self.__postinit__()
File "C:\Python36\lib\site-packages\PyInstaller\building\datastruct.py", line
161, in __postinit__
self.assemble()
File "C:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line
472, in assemble
module_hook.post_graph()
File "C:\Python36\lib\site-packages\PyInstaller\building\imphook.py", line 410
, in post_graph
self._load_hook_module()
File "C:\Python36\lib\site-packages\PyInstaller\building\imphook.py", line 377
, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "C:\Python36\lib\site-packages\PyInstaller\compat.py", line 728, in impor
tlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrappe
r
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 251, in _load_module_shim
File "<frozen importlib._bootstrap>", line 675, in _load
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Python36\lib\site-packages\PyInstaller\hooks\hook-pytest.py", line 16
, in <module>
hiddenimports = pytest.freeze_includes()
AttributeError: module 'pytest' has no attribute 'freeze_includes'

我在我的 python 文件中添加了 import pytest,但没有任何变化。请让我知道错误。

最佳答案

此问题是由 pytest 的过时版本引起的。我能够通过依次使用 pip uninstall pytestpip install pytest 更新到最新版本的 pytest 来解决它。

关于python - pyinstaller 错误 - AttributeError : module 'pytest' has no attribute 'freeze_includes' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47049697/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com