Visual Studio Code,pylint 抱怨“无法导入 XXX"; [英] Visual Studio Code, pylint complaining about "Unable to import XXX"

查看:48
本文介绍了Visual Studio Code,pylint 抱怨“无法导入 XXX";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio Code 来处理包含许多模块的大型 Python 项目.

I am using Visual Studio Code to work on a large python project with many modules.

我的 settings.json 看起来像这样:

My settings.json looks like this:

{
    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true,
    "python.autoComplete.extraPaths": [
        "C:/Users/.../repos/platform",
    ],
    "python.linting.pylintPath": "pylint"
}

然后在代码里面.我在平台文件夹内的所有导入模块上遇到大量错误.我安装了 python3,同时安装了 python 扩展pylint.

After that inside the code. I am getting a ton of error on all import modules which are inside the platform-folder. I have python3 installed with python extensions and pylint installed as well.

我搜索了另一个并尝试了许多不同的建议,但到目前为止没有一个对我有用.

I have searched for over an another and tried many different suggestions but none has worked for me so far.

推荐答案

您面临的当前问题与代码格式无关(由 pylint).你宁愿选择你想要拥有智能感知的解释器.它们在文档中提供如下.链接.希望这可以帮助.如果它是 TL; DR 给你.只需在 vscode 窗口上按 F1 并输入 Python:Select 你就会得到正确的提示.

The Current Problem you are facing is not regarding code formatting (by pylint). you would rather want to choose the interpreter you want to have Intellisense for. they are provided in docs as followed. link. Hope this helps. If it's TL;DR for you. just press F1 on vscode window and type Python:Select you will get right prompts.

这篇关于Visual Studio Code,pylint 抱怨“无法导入 XXX";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆