2

重新安装 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)

我看不到前进的方向。

4

1 回答 1

1

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

于 2021-08-09T08:13:56.230 回答