在使用以下命令安装sqlalchemy后:
➜ chat-server git:(main) ✗ pip3 install SQLAlchemy
Requirement already satisfied: SQLAlchemy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (1.4.6)
Requirement already satisfied: greenlet!=0.4.17 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from SQLAlchemy) (1.1.2)
然后像这样导入:
from sqlalchemy.orm import sessionmaker
visual studio代码显示错误:
Import "sqlalchemy.orm" could not be resolved from sourcePylancereportMissingModuleSource
(module) sqlalchemy
我从网上搜索过,似乎没有人面临同样的问题。我该怎么做才能解决这个问题?
我遇到了这个问题。我从我的虚拟环境在我的终端上运行pip install sqlalchemy
,它工作了。希望能有所帮助