Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to import OpenCV library in PyCharm by self-building

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 and its python3.7. My platform is Ubuntu 18.04 LTS. I can successfully use the OpenCV in terminal. But the PyCharm's project interpreter cannot find the opencv library, so I cannot use the import cv2 in my file.

I tried to rename the to and then copy to the folder "/home/user/anaconda/lib/python3.7/site/package", but I still cannot see the opencv library in the PyCharm's project interpreter using the anaconda python interpreter and also cannot use the opencv library.

Because I built the OpenCV 4.0 by Cmake, I didn't install the anaconda's opencv library using conda command.

In PyCharm, I added the "/home/user/anaconda/lib/python3.7/site/package" to the "Add content root" in the "file–>setting–>project:server–>project structure", but it didn't fix my problem.

Please help. Thanks.