The point is different, I think.
In heda post he has some doubt about what version of FC you are using.
You said you have used many, and no one was make your "code" works.
Here some general considerations:
1) use 0.20 as it is the latest stable and will have updates in the future via "point releases" so if bugs are arising, most probably they will be fixed. 0.19 is old stabel and won't receive bug fixes anymore.
2) as you could have fiddled with different versions, try to find where the configuration files for FC resides and delete this user directory to have a "clean user configuration" that could happen if you mix different versions with some caveats.
3) in which way you are running "code", the normal way is to load the code in the internal "Macro Editor" and run it from here.
simply load the
".py" or a
".FCMacro" file using the menu item
file -- Open and it will be opened in a "Macro Editor" window on FC.
Other ways are problematics, it is not impossible to make it run, but using "FreeCAD as a library" is not the "main way" to use FreeCAD and is not the most documented and supported one
4) without code is difficult to tell,
5) as the problem could reside even in some "environment variables" as Qt read also these so you should check if maybe some "old installations" has left some environment variables set around, in Windows is easy to forgot that you maybe have set and "environment variable" maybe some time ago and left it here, as it is not immediately visible.
After some time, I think that is a good way to answer these questions, so people that would help you have a clear idea of "what is happening".
For point 1) (You have already done that, so it is not difficult) use the the instructions you will find under
IMPORTANT: at the link
https://forum.freecadweb.org/viewtopic.php?f=3&t=2264 and please stay with 0.20.
Regards
Carlo D.