Merge pull request #6000 from alalek:fix_python_detection