2

I am trying run a python script that is importing clr as below:

import clr

But i am getting the following error while executing the python scripts:

Failed to create a default .NET runtime which would have been "netfx" on this system. Either install a compatible runtime or configure explicitly via 'set_runtime' or the 'PYTHONNET_*' environment variables (see set_runtime_from_env)

colinD
  • 1,641
  • 1
  • 20
  • 22
Sada
  • 29
  • 4

1 Answers1

2

I had the same problem and fixed it with this description found on github.

from pythonnet import load
load('coreclr')
import clr

I don't really know what caused the problem in my case, as it ran without problems before (maybe python/pythonnet update?). But it seems that the problem is that the wrong .NET installation is loaded.

Simon
  • 495
  • 1
  • 4
  • 18