尝试创建EXE文件时Pyinstaller错误
当我尝试使用pyinstaller -onefile gui.py
为程序创建可执行文件时,它给了我这个错误。 PYQT5和所有必需的软件包已为程序安装,但是当我尝试创建可执行文件时,它给了我这个错误
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\__init__.py", line 8, in <module>
from . import util as _util
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\__init__.py", line 103, in <module>
from .concurrency import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\concurrency.py", line 20, in <module>
from ._concurrency_py3k import await_only
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 8, in <module>
import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\base_events.py", line 296
future = tasks.async(future, loop=self)
^^^^^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 845, in main
build(specfile, distpath, workpath, clean_build)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 767, in build
exec(code, spec_namespace)
File "E:\Imalka\VarCheck\gui.spec", line 7, in <module>
a = Analysis(
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 319, in __init__
self.__postinit__()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 487, in assemble
self.graph.process_post_graph_hooks(self)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 326, in process_post_graph_hooks
module_hook.post_graph(analysis)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 398, in post_graph
self._load_hook_module()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 361, in _load_hook_module
self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\compat.py", line 620, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1063, in load_module
File "<frozen importlib._bootstrap_external>", line 888, in load_module
File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
File "<frozen importlib._bootstrap>", line 719, in _load
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 31, in <module>
dialects = eval(dialects.strip())
File "<string>", line 0
SyntaxError: invalid syntax
When i try to create the executable for my program using pyinstaller --onefile gui.py
it gives me this error. pyqt5 and all the required packages are installed for the program but when i tried to create the executable it gives me this error what is wrong with the process
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\__init__.py", line 8, in <module>
from . import util as _util
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\__init__.py", line 103, in <module>
from .concurrency import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\concurrency.py", line 20, in <module>
from ._concurrency_py3k import await_only
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 8, in <module>
import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\base_events.py", line 296
future = tasks.async(future, loop=self)
^^^^^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 845, in main
build(specfile, distpath, workpath, clean_build)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 767, in build
exec(code, spec_namespace)
File "E:\Imalka\VarCheck\gui.spec", line 7, in <module>
a = Analysis(
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 319, in __init__
self.__postinit__()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 487, in assemble
self.graph.process_post_graph_hooks(self)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 326, in process_post_graph_hooks
module_hook.post_graph(analysis)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 398, in post_graph
self._load_hook_module()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 361, in _load_hook_module
self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\compat.py", line 620, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1063, in load_module
File "<frozen importlib._bootstrap_external>", line 888, in load_module
File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
File "<frozen importlib._bootstrap>", line 719, in _load
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 31, in <module>
dialects = eval(dialects.strip())
File "<string>", line 0
SyntaxError: invalid syntax
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后,我找到了解决错误的解决方案。它是因为Asyncio软件包使用
pip卸载asyncio
删除软件包并运行Pyinstaller,它将编译.EXE文件Finally i found a solution to fix the error. it because of the asyncio package remove the package using
pip uninstall asyncio
and run the pyinstaller it will compile the .exe file