小编MrC*_*vin的帖子

使用 pythonnet 从 .Net Core 调用 python 脚本

我正在尝试让 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)

.net c# python python.net .net-core

5
推荐指数
1
解决办法
8921
查看次数

返回多个对象的 cmdlet,它是什么集合类型(如果有)?[电源外壳]

Get-ADusercmdlet的示例:

$Users = Get-ADuser -Filter *
Run Code Online (Sandbox Code Playgroud)

在大多数情况下它会返回多个 ADuser 对象,但它是什么“集合”类型?文档只说它会返回一个或多个 Microsoft.ActiveDirectory.Management.ADUser 的用户对象。

尝试使用例如,($Users -is [System.Collections.ArrayList])但我无法确定“集合”类型?

arrays collections powershell cmdlet

3
推荐指数
1
解决办法
332
查看次数

适用于 .net Core/Standard 的 SQLite 库:MS EF 还是 sqlite.org?

我无法概述与 .Net Core 和/或 Standard 一起使用的不同 SQLite 库。看来主要有两个:

MS 库完全独立于 sqlite.org 的库吗?如果是的话,建议使用哪一种?我更喜欢简单性......如果使用 sqlite.org,我似乎只需要两个 dll。

sqlite system.data.sqlite .net-core .net-standard .net-standard-2.0

1
推荐指数
1
解决办法
1841
查看次数