These search terms have been highlighted:[python]
Import a different version of OpenCV in Python
2017-03-05
When there are two versions of (e.g. OpenCV) libraries in a system, how to specify the imported version in Python?
The search paths of imported libraries are defined as the variable sys.path which is a list type. Modifying this variable, we can add/remove a search path. The order of search is from the beginning of sys.path. If we add a path by sys.path.append(...), it has a lowest priority. Thus we need to add a path in front of the list.
e.g.
import sys
sys.path= ['/home/user/.local/lib/python2.7/dist-packages/']+sys.path
import cv2