Binary not allowed for architecture x86_64

Just updated to Monterey and when building openexr the following error occurred:

ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.tbd for architecture x86_64

My mac is a Intel CPU model. Anyone knows what's going on?

Binary not allowed for architecture x86_64
 
 
Q