【问题标题】:Pylance issues from google-cloud-sdk来自 google-cloud-sdk 的 Pylance 问题
【发布时间】:2021-10-11 05:56:56
【问题描述】:

我重新安装 Windows 后,Pylance 显示 Google Cloud SDK 错误。

from google.appengine.ext import ndb

class Example(ndb.Model):
    basic_example = ndb.StringProperty()

第一个问题,由导入:

无法解析导入“google.appengine.ext”Pylance (reportMissingImports)

我需要为 Cloud SDK 添加额外路径。我已经看到/尝试了各种解决方案并发现这很有效:

{ // settings.json
  "python.analysis.extraPaths": [
    "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine"
  ],
  "python.autoComplete.extraPaths": [
    "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine"
  ]
}

当前问题,使用该库的位置;整个代码。

“模型”不是模块Pylance(reportGeneralTypeIssues)的已知成员

“StringProperty”不是模块Pylance(reportGeneralTypeIssues)的已知成员

我看不到前进的方向。

【问题讨论】:

    标签: python visual-studio-code google-cloud-platform google-cloud-sdk pylance


    【解决方案1】:

    项目运行 Python 2.7,而 Pylance 需要 3.0。

    【讨论】:

      猜你喜欢
      • 2016-07-14
      • 2021-12-19
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 2014-06-08
      • 1970-01-01
      • 1970-01-01
      • 2022-01-27
      相关资源
      最近更新 更多