My earliest exposure for Python was from Linux distros. Originally Perl was used for stringing together a Linux distribution, but then Python took over the role, slowly. Batteries included stdlib helped a lot there, and also because there wasn't much else like it back then (remember, Python is older than Java). And then since it was already there, everybody suggested it and used it as introduction to programming. Incidentally (or not) it was also intended for and suitable for first time programmers with ridiculously simple syntax and so it became the lingua franca of programming lessons everywhere. I suspect that (along with excellent C/C++ interop) had a chance in getting it picked up as front end for ML frameworks, and then here we are.