IronPython invocation from C# (with SciPy) fails with ImportException: “No module named mtrand”

后端 未结 2 1474
我寻月下人不归
我寻月下人不归 2021-02-05 15:10

I have a python library I am trying to use via IronPython (v2.7 RC1 [2.7.0.30]) invocation from C# application. The library uses NumPy and SciPy quite extensively, which

2条回答
  •  情深已故
    2021-02-05 15:19

    Not the best soultion, but its works for me:

    import sys
    sys.path.append(r'c:\Program Files (x86)\IronPython 2.7')
    sys.path.append(r'c:\Program Files (x86)\IronPython 2.7\DLLs')
    sys.path.append(r'c:\Program Files (x86)\IronPython 2.7\Lib')
    sys.path.append(r'c:\Program Files (x86)\IronPython 2.7\Lib\site-packages')
    
    import clr
    clr.AddReference('mtrand.dll')
    
    import numpy
    import scipy
    
    print numpy.__version__
    print scipy.__version__
    

    I hope it helps.

提交回复
热议问题