Traceback (most recent call last):
File "D:\Space\discord_count_bot\bot\bot\main.py", line 12, in <module>
dbConnection.init_connection(
File "D:\Space\discord_count_bot\bot\bot\db_hanler.py", line 78, in init_connection
engine = create_async_engine(connection_string, future=True, echo=True)
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 40, in create_async_engine
sync_engine = _create_engine(*arg, **kw)
File "<string>", line 2, in create_engine
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\util\deprecations.py", line 298, in warned
return fn(*args, **kwargs)
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\engine\create.py", line 560, in create_engine
dbapi = dialect_cls.dbapi(**dbapi_args)
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\dialects\postgresql\psycopg2.py", line 782, in dbapi
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
如果安装了
psycopg2
,我会得到
Traceback (most recent call last):
File "D:\Space\discord_count_bot\bot\bot\main.py", line 12, in <module>
dbConnection.init_connection(
File "D:\Space\discord_count_bot\bot\bot\db_hanler.py", line 78, in init_connection
engine = create_async_engine(connection_string, future=True, echo=True)
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 41, in create_async_engine
return AsyncEngine(sync_engine)
File "D:\Space\discord_count_bot\bot_env\lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 598, in __init__
raise exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async.