It seems that Alpine's boost-dev package (required to build pyexiv2) installed Python 3, and this somehow confuses pyexiv2's build process, which ends up compiling against the Python 3 libraries instead of the Python 2 ones.