简体   繁体   English

如何让 VS Code 编辑器知道属于 python 中的导入包?

[英]How to make VS Code editor aware belonging imported packages in python?

I use VS Code to write and test python scripts.我使用 VS Code 来编写和测试 python 脚本。

Is it possible to make the editor aware of imported modules是否可以让编辑器知道导入的模块

to avoid problems listed like避免列出的问题

Module 'numpy' has no 'divmod' member模块“numpy”没有“divmod”成员

You would update the Python interpreter settings according to where modules have been installed.您将根据模块的安装位置更新 Python 解释器设置。 (bottom right of VS Code) (VS Code 右下角)

The IDE being used isn't really relevant because you could invoke /path/to/bin/python , start a REPL, import the same module, and get the same error正在使用的 IDE 并不真正相关,因为您可以调用/path/to/bin/python ,启动 REPL,导入相同的模块,并得到相同的错误


Regarding, "numpy has no ... member", based on searching, that is a PyLint issue, not an import issue关于,“numpy has no ... member”,基于搜索,这是一个 PyLint 问题,而不是一个导入问题

How do I get PyLint to recognize numpy members? 如何让 PyLint 识别 numpy 成员?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM