我正在尝试让 pythonnet 在我在 Linux 上运行的 .Net Core 应用程序中工作。
我在我的 .Net Core 项目中引用了Python.Runtime.dll(我从nuget 获得)。
我的代码是:
using System;
using Python.Runtime;
namespace pythonnet_w
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start");
using (**Py.GIL()**) {
// blabla
}
Console.WriteLine("End");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到此运行时错误:
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Reflection.Emit.AssemblyBuilder
System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.
at Python.Runtime.CodeGenerator..ctor()
at Python.Runtime.DelegateManager..ctor()
at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv)
at Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv)
at Python.Runtime.PythonEngine.Initialize()
at Python.Runtime.Py.GIL()
at pythonnet_w.Program.Main(String[] args) in D:\Development\~.Net libraries (3.part)\phytonnet\.Net Core test (phytonnet)\c#\pythonnet_test\Program.cs:line …Run Code Online (Sandbox Code Playgroud) Get-ADusercmdlet的示例:
$Users = Get-ADuser -Filter *
Run Code Online (Sandbox Code Playgroud)
在大多数情况下它会返回多个 ADuser 对象,但它是什么“集合”类型?文档只说它会返回一个或多个 Microsoft.ActiveDirectory.Management.ADUser 的用户对象。
尝试使用例如,($Users -is [System.Collections.ArrayList])但我无法确定“集合”类型?
我无法概述与 .Net Core 和/或 Standard 一起使用的不同 SQLite 库。看来主要有两个:
MS 库完全独立于 sqlite.org 的库吗?如果是的话,建议使用哪一种?我更喜欢简单性......如果使用 sqlite.org,我似乎只需要两个 dll。
sqlite system.data.sqlite .net-core .net-standard .net-standard-2.0
.net-core ×2
.net ×1
arrays ×1
c# ×1
cmdlet ×1
collections ×1
powershell ×1
python ×1
python.net ×1
sqlite ×1