Autocomplete in PyCharm for Python compiled extensions

后端 未结 9 867
遥遥无期
遥遥无期 2020-12-09 02:46

When writing Python code using compiled extensions (the OpenCV Python bindings, for example), PyCharm doesn\'t seem to be aware of their availability. The imports are marked

9条回答
  •  无人及你
    2020-12-09 03:11

    The imports are marked with a grey underline, saying "unresolved reference" as a tooltip

    This most probably means that PyCharm can't see the module you import. In editing mode, PyCharm relies on availability of Python sources of imported modules. If a module is not written in Python but is a C extension module, PyCharm generates a 'skeleton' that contains function prototypes, and uses it for completion.

    In shell mode, PyCharm uses live imported objects for completion, with slightly different results.

    Make sure that your OpenCV installation is visible for the Python interpreter you chose for the project (File / Settings / Python interpreter). If the interpreter is correct, try removing and re-adding it (this is time-consuming a bit, sorry).

    If nothing helps, file a bug.

提交回复
热议问题