我已使用 pyinstaller 将 test.py 文件转换为 test.exe 文件:
pyinstaller --onefile --hidden-import mysql.connector.plugins.caching_sha2_password test.py
但这给了我以下错误:
Requested Module was not found: No module named 'mysql.connector.plugins.caching_sha2_password'
Traceback (most recent call last):
File "test.py", line 8, in <module>
new_records = execute_query("SELECT * FROM queue WHERE state='pend'")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "database.py", line 5, in execute_query
connection = mysql.connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^
File "mysql\connector\pooling.py", line 294, in connect
File "mysql\connector\connection.py", line 167, in __init__
File "mysql\connector\connection.py", line 622, in close
File "mysql\connector\connection.py", line 1132, in cmd_quit
File "mysql\connector\network.py", line 172, in send_plain
File "mysql\connector\errors.py", line 54, in __init__
File "mysql\connector\locales\__init__.py", line 62, in get_client_error
ImportError: No localization support for language 'eng'
[10468] Failed to execute script 'test' due to unhandled exception!
你能帮我解决这个问题吗
我还使用 Pyinstaller 创建一个 .exe 应用程序。我能够通过以下导入解决该错误:
from mysql.connector.locales.eng import client_error
但是现在我遇到了这个新错误:
不支持身份验证插件“caching_sha2_password”。 找不到请求的模块:没有名为“mysql.connector.plugins.caching_sha2_password”的模块
我希望找到这个新错误的解决方案。我尝试卸载 mysql-connector 和 mysql-connector-python 库,但似乎没有任何作用。
我相信这些信息是有用的。