![](/img/trans.png)
[英]Pylint Error with Python Turtle even though code executes properly
[英]pylint import error in vscode even though python executer successfully imports it
我正在使用 vscode 来编码我的 python 代码。 我在我的代码中使用了 pandas、numpy 和 requests 库。 如果我运行代码,它工作正常。 但是在 VScode 编辑器中,在问题部分,它总是说消息为
Unable to import 'numpy' (pylint import error)
Unable to import 'pandas' (pylint import error)
Unable to import 'requests' (pylint import error)
我在 StackOverflow 问题中搜索了这个问题的答案,它说使用pip
安装pandas
。 我也是这样做的。 但我仍然面临同样的问题。 如何在 vs 代码编辑器中解决此问题
这并不是告诉您未安装numpy
或pandas
。 它告诉您pylint
无法验证您的numpy
和pandas
调用。 大多数numpy
和pandas
是用 C 编写的,而不是 Python。
pylint
文档说
Linting C 扩展模块不支持开箱即用,特别是因为 pylint 无法从扩展模块中获取 AST 对象。
所以你的代码没有问题,即使 VSCode 说这是一个问题。 这是pylint
的技术限制。 如果您担心,请为这些import
语句禁用pylint
消息 E401。 将#pylint: disable=E401
与import
语句放在同一行。
检查您是否安装了pylint。 要安装 pylint,请在终端中输入:
$ pip install pylint
(这对我有用)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.