How should OpenCV 2 be installed on Ubuntu 16.04.5 LTS?

I need OpenCV 2 for a legacy program, specifically OpenCV I have attempted to install python-opencv= and libopencv-dev= The former appears to install, and when I try to install the latter, having removed its OpenCV 3 equivalent (which has recently become the default), Ubuntu retains some unmet dependency problems which seem to arise from removing OpenCV 3. I have attempted to install libopencv-legacy-dev, which appears to install, but then I am met with the standard OpenCV wrong version error: ImportError: No module named cv2.