简体   繁体   中英

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.

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.

In pyppeteer/__init__.py , simply add the line

__version__="0.2.5"

after the lines:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM