This is probably due to mixup of different Python environments.
We have encountered this problem when we simply wanted to run a terminal in Slicer’s Python environment:
@jcfr can you help us here? This user site packages/sysconfigdata issues has come up again. Should we add Py_NoSiteFlag=1
in Slicer as suggested here and here? (although I’m not sure how that could fix launching of a terminal or gdb)