I’ve heard there are Python libraries which actually allow to compile code into executables, but I haven’t looked into it.
Usually you want compilers if you are looking for optimized and efficient code. Hence those are low-level languages where you have to write a lot more to make it work - but at the same time save a lot of computational power because it’s just optimized for the problem. Those are used for games and engines, where a lot of data has to be calculated fast, so players can enjoy the games without lag and such.
Interpreter languages are used for things where you can accept some level of delay. They take more computational-power and -time, but are easier to write and maintain. If a website takes two seconds longer to load, that’s ok. If a machine-learning algorithm takes 10 hours instead of 9 for training, nobody cares → because you save weeks of writing the code and worst case, it’s easier and cheaper to just upgrade the machine, than to find and pay additional programmers.
Data-types are one key difference. C++ has strict typing: meaning if you make an integer variable, it will have a fixed size in memory ( like one Byte ), a max and min value and if you go beyond those or try to write anything but an integer number on that variable, the program will produce garbage.
Python doesn’t give a damn. If you create an integer variable there, it will be like 20 Bytes because it comes pre-made with all kinds of additional functionality. And if you combine it with a float and/or a string, Python will try to produce something reasonable - meaning a lot of stuff happening in the background.
That’s why compiling it is pretty hard. Because there is so much background functionality within script-languages, turning them into an executable would need the inclusion of all the background stuff. And if you’d need to put the entire interpreter into the .exe, you could just install the interpreter directly and not bother, instead of having it added into every single executable file.