gpt4 book ai didi

.net - 如何在 .Net Core 1.0 中使用 IronPython

转载 作者:行者123 更新时间:2023-12-05 00:47:14 28 4
gpt4 key购买 nike

我正在尝试将 IronPython 添加到 .Net Core 1.0 Web 应用程序,但在访问 ScriptRuntime 类时遇到问题。当我尝试添加 using IronPython; 时我收到错误消息,说找不到 IronPython。

我也收到关于 ScriptRuntime does not exist in the current context 的错误

注:目前在 OSX 10.11 上使用 Visual Studio Code

以下是我的 project.json 的依赖项和框架部分:

{
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.Sqlite": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Newtonsoft.Json": "8.0.3",
"IronPython": "2.7.5",
"IronPython.StdLib": "2.7.5"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
}

在我的 Controller 中,我有以下 using 语句:
using System.IO;
using System.Diagnostics;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json.Linq;
using MatrixSynthesisWebApp.Models;
using System.Dynamic;
using System.Runtime.CompilerServices;
using IronPython;

最佳答案

Svicks 的回答不是目前的状态:

IronPython-Team 刚刚发布了 IronPython 2.7.8 的测试版,支持 mono 和 .net 核心:

更多信息在这里:https://github.com/IronLanguages/ironpython2/releases

IronPython 3 支持 mono 和 .net 核心仍在开发中。

关于.net - 如何在 .Net Core 1.0 中使用 IronPython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37377987/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com