无法导入 'azure.functions' pylint(import-error) [3,1] 和无法导入 '__app__modules.library_finder' pylint(import-error) [4,1]

sir*_*iri 4 pylint importerror visual-studio-code

我正在尝试在 Microsoft Azure 中测试无服务器 Python Chatbot API,但是当我按照在线指南https://towardsdatascience.com/creating-a-serverless-python-chatbot-api-in-microsoft-azure-from- Scratch-in-9-easy-steps-2f1913fc9581

它给出了这些错误:无法导入 'azure.functions' pylint(import-error) [3,1] 无法导入 '__app__modules.library_finder' pylint(import-error) [4,1]

知道如何解决这个问题吗?

问候

小智 17

这个错误来自pylint。似乎 linter 没有指向 .env,因此无法验证 azure 包!要解决它,你可以试试这个:

在 Visual Studio 代码中:

  • 在状态栏中找到 Python 版本并点击它
  • 选择项目所在的 Azure 工作区
  • 为您显示 Python 版本列表。选择以 ./.venv/ 开头的那个(在我的例子中,它是:./.venv/bin/python)
  • 然后您可能会看到一个弹出窗口,提示未安装 Linter pylint。
  • 单击安装按钮安装它,你应该很高兴

希望这可以帮助