问题标签 [pylance]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 选择 conda 作为 python 解释器时 pylance `unresolved import` 错误
我正在使用 vscode 并使用 pylance 在 python 中进行 linting 尝试导入 restframework 时出现错误:
Import "rest_framework.decorators" could not be resolved
当我选择 conda 环境作为我的 python 解释器时出现此错误,但如果我选择默认 python 路径作为我的解释器,我不会收到此错误。
为什么只有当我选择 conda 环境作为解释器路径时才会出现此类错误
请通过回答帮助我。
python - 有没有办法在 VSCode/pylance 中将 python 函数标记为不完整/未实现?
我对 python 比较陌生,使用 VSCode 进行 python 开发。据我所知,VSCode 正在使用一个名为“pylance”的扩展来处理 python 支持功能,例如在您编写时检测代码中的错误。
在我使用的最后一种语言(Scala)中,有一个很棒的小表达式???
可以用来将方法标记为不完整/未实现,这样它就不会在编译器或 IDE 中产生任何错误,并且只会抛出一个如果在运行时遇到异常。
python中是否有任何等价物,特别是pylance可以理解的?这个想法是有一个未实现的函数,或者一个返回类型提示不满足的函数,因为它不完整,但这不会引发任何错误,这会使我更难找到部分的问题'实际上正在努力。
显然这不是关键,只是偏好问题,但最好保持信噪比低!谢谢
python - 来自 google-cloud-sdk 的 Pylance 问题
重新安装 Windows 后,Pylance 显示 Google Cloud SDK 错误。
第一个问题,由导入:
导入“google.appengine.ext”无法解析Pylance (reportMissingImports)
我需要为 Cloud SDK 添加额外路径。我已经看到/尝试了各种解决方案并发现这很有效:
当前问题,使用该库的位置;到处都是代码。
“模型”不是模块Pylance 的已知成员(reportGeneralTypeIssues)
“StringProperty”不是模块Pylance 的已知成员(reportGeneralTypeIssues)
我看不到前进的方向。
python - Intellisense 无法将 sklearn 返回的变量识别为数组类型
(我的环境是使用pylance的vs代码)
例如,从数组返回train_test_split()
或LinearRegression.predict()
不被识别为数组并且不提供任何自动完成建议。在输入 google colab 和 spyder 后my_returned_array.
,我得到一长串可用的数组函数,但在 带有 pylance 的 VS 代码中我什么也没得到。
我需要做一些额外的配置还是需要使用其他扩展?
python - visual studio code with pylance cannot resolve imports while using docker
I set up visual studio code to use a docker instance provided to me. For some reason pylance cannot locate some of my imports even though I added the import path in the settings.json for user, container and workspace. I am wondering if anybody has experience with that and can help me. Adding some pictures that shows the issue. In particular i am interested in pylance locating the cocotb library. Thanks for any help Amish
python - 如果有多个可能的返回值,pyright 是否应该根据传递的参数自动推断正确的返回值?
我有以下功能:
我对它的理解是,如果我None
作为参数传递,我总是得到None
作为返回值。另一方面,etree._Element
as 参数总是会导致str
返回。
如果我使用 pylance 在 vscode 中编写以下内容(它在后台使用 pyright):
在这种情况下,我得到类型提示(variable) variable: str | None
。我希望 pylance 知道该变量应该是 type str
。我在监督什么吗?这可能是一个错误吗?
如果这按预期工作:是否有可能手动告诉 pylance“只要这个函数得到 aetree._Element
它就会返回 astr
并且每当我通过None
它时它就会返回None
”?
python - 导入“unittest2”无法解决 Pylance
我在树莓派的 Python 代码中遇到了这个错误。
python - Visual Studio 代码报告 docopt 导入错误,而 bash 终端没有问题
刚刚安装了关于我在 main.py 中的代码的扩展 ms-python.python Visual Studio 代码报告
}
为什么我可以正常导入模块而 vscode 扩展ms-python.python不能?
如果我跑python