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

后端 未结 2 1472
我寻月下人不归
我寻月下人不归 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:42

    I found that, in my ActivePython V2.7.0.2, this works:

    sys.path.append(r'C:\\Examples')
    import examples
    

    (assuming examples.py is in C:\Examples). This doesn't (without the r):

    sys.path.append('C:\\Examples')
    import examples
    

    Because I get this:

    Traceback (most recent call last):
      File "", line 1, in 
    ImportError: No module named examples
    

    Conclusion: mind the r''!

提交回复
热议问题