Ask Your Question

Revision history [back]

Cannot run OpenCV from virtual environment: cannot find libopencv_freetype.so.3.2

I just finished installing OpenCV from source, and I can import cv2 fine in both Python 2 and Python 3 when I'm not in a virtual environment. However, as soon as I enter my virtual environment, I can no longer import cv2. I get the following error:

ImportError: libopencv_freetype.so.3.2: cannot open shared object file: No such file or directory

I've looked it up online, and I see plenty of people having trouble loading libopencv_core, but not libopencv_freetype. I've looked for libopencv_freetype.so.3.2 on my computer, and it's not there, so I'm not sure why it works outside of the virtual environment.

The syntax I used to create my virtual environment was virtualenv ~/.virtualenvs/facialrecog -p /usr/bin/python3.5 --system-site-packages.

Any suggestions would be greatly appreciated!