简体   繁体   English

Pytho.net 无法加载 System.IO.Path (.net 6.0)

[英]Pythonnet cann't load System.IO.Path (.net 6.0)

I use Python 3.10 and Net 6.0.我使用 Python 3.10 和 Net 6.0。 And my C# code call Directory.GetFiles function from System.IO.我的 C# 代码从 System.IO 调用 Directory.GetFiles function。

When I call dll from python using Pytho.net, it showed cannot load type: System.IO.Path.当我使用 Pytho.net 从 python 调用 dll 时,它显示无法加载类型:System.IO.Path。

Please provide some instructions.请提供一些说明。 Thanks.谢谢。

from clr_loader import get_coreclr
from pythonnet import set_runtime
rt = get_coreclr(runtime_config = r"D:\runtimeConfig.json")
set_runtime(rt)

and json file:和 json 文件:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.0"
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM