OpenCV built from source: Pycharm doesn't get autocomplete information

后端 未结 2 1663
后悔当初
后悔当初 2021-01-24 01:07

I\'m trying to install OpenCV into my python environment (Windows), and I\'m almost all of the way there, but still having some issues with autocomplete and Pycharm itself impor

相关标签:
2条回答
  • 2021-01-24 01:21

    Got it finally! Figures that would happen just after posting the question...

    Turns out .../envs/cv/site-packages/cv2/python-3.8/cv2.cp38-win_amd64.pyd needed to be copied to .../envs/cv/DLLs/. Then PyCharm did it's magic and is now all good.

    0 讨论(0)
  • 2021-01-24 01:21

    Alternatively add the directory containing the .pyd file to the interpreter paths.

    I had exactly this problem with OpenCV 4.2.0 compiled from sources, installed in my Conda environment and PyCharm 2020.1.

    I solved this way:

    1. Select project interpreter
    2. Click on the settings button next to it and then clicking on the Show paths for selected interpreter
    3. adding the directory containing the cv2 library (in my case in the Conda Python library path - e.g. miniconda3/lib/python3.7/site-packages/cv2/python-3.7). In general check the site-packages/cv2/python-X.X directory)
    0 讨论(0)
提交回复
热议问题