You can use SetDotNetRuntime
command to set Rhino to run in a dotnet framework or dotnet core.
This is most probably related to dotnet core. It works in your vscode since it is running native python and is not dealing with the dotnet core runtime the way python in Rhino does.
Try it with dotnet framework and see if it works there