[英]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 line在pyppeteer/__init__.py
中,只需添加该行
__version__="0.2.5"
after the lines:行后:
try:
__version__ = version(__name__)
except Exception:
pass
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.