简体   繁体   English

将 python 文件转换为可执行文件时出现 Pyinstaller 脚本错误

[英]Pyinstaller script error when converting a python file into an executable

I'm trying to use pyinstaller to convert my python file into an executable, but I keep getting this error.我正在尝试使用 pyinstaller 将我的 python 文件转换为可执行文件,但我不断收到此错误。

Traceback (most recent call last):
  File "sr_gui_test.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "requests_html.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "pyppeteer\__init__.py", line 43, in <module>
NameError: name '__version__' is not defined

I have no idea what this version variable is and how I should fix this.我不知道这个版本变量是什么以及我应该如何解决这个问题。

There is a workaround on pyppeteer issue #213 : editing the __init__.py as nonewind suggests. pyppeteer issue #213有一个解决方法:按照 nonewind 的建议编辑__init__.py

In pyppeteer/__init__.py , simply add the linepyppeteer/__init__.py中,只需添加该行

__version__="0.2.5"

after the lines:行后:

try:
    __version__ = version(__name__)
except Exception:
    pass

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用pyinstaller将python脚本转换为可执行文件后,我得到:加载共享库时出错...权限被拒绝 - After converting python script to executable with pyinstaller I get: error while loading shared libraries… Permission denied 使用 pyinstaller 将 python 文件转换为 an.exe 文件时出现 opencv 错误 - opencv error when converting a python file to an .exe file with pyinstaller 使用pyinstaller创建可执行文件时出错 - Error when creating executable file with pyinstaller 使用Pyinstaller将运行bash脚本的python脚本转换为可执行文件 - Convert python script which runs a bash script to executable file with Pyinstaller 由于 PyBluez 错误,使用 PyInstaller 创建可执行 python 脚本时出错 - Error creating an executable python script with PyInstaller due to PyBluez error Python pyinstaller 将 py 转换为 exe 时出错 - Python pyinstaller error when converting py to exe 转换为exe时出现Python pyinstaller错误 - Python pyinstaller error when converting to exe 如何允许 python 脚本复制使用 pyinstaller 创建的可执行文件? - How to allow python script to replicate the executable file created with pyinstaller? Pyinstaller - “致命错误! 将脚本转换为 exe 时无法执行脚本” - Pyinstaller - “Fatal error ! Failed to execute script” when converting script to exe 在另一台机器上运行可执行文件时,PyInstaller 错误加载 Python DLL - PyInstaller error loading Python DLL when running executable on another machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM