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 cv2.cpython-37m-x86_64-linux-gnu.so to cv2.so 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.
how to configure that is probably way off here
now you have 2 versions (bad !!!!), and none fits ?
Sorry, I make you misunderstood. I install the opencv4 by cmake using the anaconda's python 3.7. Now, I found the problem, as I set the python3 package path as "lib/python3.7/site-packages". It should be "/home/user/anaconda3/lib/python3.7/site-packages". Therefore, I rebuild again. But I face another problem.
ah, ok, thanks for the clarification ;)