VSCode 自动完成功能不适用于从源代码安装的 OpenCV [英] VSCode autocomplete not working for OpenCV installed from source

查看:187
本文介绍了VSCode 自动完成功能不适用于从源代码安装的 OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只发现了另外一个问题,但没有答案,所以我在这里问.

I've only found one other question asking exactly this with no answer, so I'm asking here.

我运行的是 Ubuntu 18.04,VSCode 最新版本.

I am running Ubuntu 18.04, VSCode latest version.

我已将 OpenCV 3.4.9 从源安装到/usr/local

I have installed OpenCV 3.4.9 from source to /usr/local

当我导入 cv2 然后尝试输入cv2."时,VSCode 无法自动完成.它提出的唯一建议是bootstrap"和os".我对任何其他模块(如 numpy 或 rospy)的自动完成都没有问题,甚至在从 pip 安装 OpenCV 时也没有问题.似乎只有从源代码安装 OpenCV 时才会出现问题.

When I import cv2 and then try to type "cv2.", VSCode is unable to autocomplete. The only suggestions it makes are "bootstrap" and "os". I have no problem with autocomplete with any other module like numpy or rospy, or even when OpenCV is installed from pip. It seems the issue is only when OpenCV is installed from source.

我已经尝试过语言服务器和 Jedi.我也尝试过各种短绒.

I have tried both the language server as well as Jedi. I have also tried various linters.

感谢任何帮助.

推荐答案

我也遇到了同样的问题.希望这有帮助

I have encountered the same problem. Hope this helps

这是因为该软件包未安装在通常位置,而是安装在自定义位置.这个问题可以通过一些配置更改来解决.配置 settings.json 以包含自动完成工作的自定义位置.将路径添加到 python.autoComplete.extraPaths

Its because the package is not installed in the usual location but in a custom location. This problem could be resolved by some configuration changes. Configure the settings.json to include the custom location for autocompletion to work. Add path to python.autoComplete.extraPaths

第 1 步:确定自定义库/模块的位置.

STEP 1:Identify the location of the custom library/module.

第 2 步:在用户设置或工作区设置文件中进行必要的更改.

STEP 2: Make the necessary changes in the User Settings or Workspace Settings file.

这是用户设置中的示例条目(提及模块的确切位置)

Here’s a sample entry in the User Settings (Mention the exact location of the module)

    "C:/Program Files (x86)/---/---",
    "C:/Program Files (x86)/---/---/lib" ]

这篇关于VSCode 自动完成功能不适用于从源代码安装的 OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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