Fix api.cpp not regenerated when switching python version