简体   繁体   English

python:Sqlalchemy 和 Pyinstaller 有问题

[英]python: problem with Sqlalchemy and Pyinstaller

I wrote a code with pyqt5 pandas sqlalchemy pyodbc libraries but when I want to make an exe from my py file with pyinstaller I get this error:我用 pyqt5 pandas sqlalchemy pyodbc 库写了一个代码,但是当我想用 pyinstaller 从我的 py 文件制作一个 exe 时,我得到这个错误:

in _load_hook_module
    self._hook_module = importlib_load_source(
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\PyInstaller\compat.py", line 632, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 529, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1029, in load_module
  File "<frozen importlib._bootstrap_external>", line 854, in load_module
  File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 711, in _load
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 32, in <module>
    dialects = eval(dialects.strip())
  File "<string>", line 0

SyntaxError: unexpected EOF while parsing

I searched for about 2 hours bet I couldn't find any solution我搜索了大约 2 小时打赌我找不到任何解决方案

if you need to see my code comment on it and I will update the question with my code that I want to make exe of如果您需要查看我的代码评论,我会用我想制作 exe 的代码更新问题

I finally get it to work我终于让它工作了

I was exploring about my error till I found this: this我一直在探索我的错误,直到我发现这个:这个

and there was a guy that said: if you install asyncio externally and you use above 3.3 python version then uninstall asyncio using pip uninstall asyncio it's works for me because 3.4 and above version added this in python-core so no need to add externally asyncio并且有一个人说:如果你在外部安装 asyncio 并且你使用 3.3 python 版本以上然后使用 pip 卸载 asyncio

and what I have done actually: pip uninstall asyncio and it works like a charm!!!!以及我实际所做的:pip 卸载 asyncio,它就像一个魅力!!!!

Thank you all谢谢你们

I faced the same issue when generating an executable with pyinstaller, simply run this line before invoking pyinstaller.我在使用 pyinstaller 生成可执行文件时遇到了同样的问题,只需在调用 pyinstaller 之前运行这一行。

pip uninstall asyncio

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

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