Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 views
in Technique[技术] by (71.8m points)

python - After I convert PY to EXE using PyInstaller it throw error

after I converted my PY file to EXE and I ran it, I got this error:

Traceback (most recent call last):
  File "PrngCipher.py", line 2, in <module>
    from kivy.app import App
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstallerloaderpyimod03_importers.py", line 546, in exec_module
  File "kivy\__init__.py", line 272, in <module>
  File "C:Program FilesPython39Libsite-packagesPyInstallerhooks
thookspyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
    assert pkg_path.startswith(SYS_PREFIX)
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath

I'm new to Python and PyInstaller, I don't know what this error is about, I followed many tutorials and hooked the right dependencies into the .spec file but it still broke. My .py, .kv and .spec file: https://drive.google.com/drive/folders/1F7I4xEphB3d2ErDPs7vGDpT7trTmHKgC?usp=sharing

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I did more research and looked into the upper lines of the error message and I found out the problem was at the PyInstaller pakage's code not my code, the fix is to downgrade PyInstaller to 4.3 waiting for a fix using python -m pip install PyInstaller==4.3 and it worked fine


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...