Make error: libIlmImf-2_2.so.22, needed by /usr/local/lib/libopencv_imgcodecs.so.4.6.0, not found

I am running this on Ubuntu 20. I have libopenexr installed but it is a newer version containing libIlmImf-2_3.so.24. Can someone please help me fix this issue?