python - 无法找到来自 NuGet 的 IronPython StdLib

标签 python visual-studio nuget ironpython

我已经从 NuGet 安装了 IronPython 和 IronPython.StdLib。从有关该主题的其他帖子(例如 this )来看,我似乎可以简单地添加

clr.AddReference(IronPython.StdLib) 

到我的 python 模块,然后可以使用 CPython 模块,例如“os”。但它不起作用。

使用上面的行,我收到以下错误:

"Could not add reference to assembly IronPython.StdLib"

如果我注释该行,则找不到“os”:

"No module named os"

如何让我的 python 脚本找到 NuGet 安装的 StdLib?

最佳答案

IronPyton.StdLib 包没有预编译的 stdlib(尽管我已经考虑过这一点);它本身具有实际的 stdlib 文件,应该将其解压到项目中的 Lib 目录中。您需要使用 engine.SetSearchPaths 将该目录添加到 IronPython 搜索路径,并且您应该能够导入。

关于python - 无法找到来自 NuGet 的 IronPython StdLib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16232861/

相关文章:

git - 在 Visual Studio Online 中使用自定义 NuGet 源

c# - ASP.NET Web API 项目中的 System.Data.Common、System.Net.Http 框架与 Nuget 程序集

visual-studio - Visual C# Express 中的 Visual Studio 命令提示?

Python:两个函数之间的重叠(kde 和正常的 PDF)

未调用python模拟函数

python - 从Windows Server 2008中的powershell 3.0脚本获取python版本

c# - 如何在 Windows Phone 7 上将 BitmapImage 调整为 50x50?

visual-studio - 某些库强制 Visual Studio 每次都编译 F# 项目

asp.net-core - 通过 Nuget 安装时,.Net 核心解决方案中的 Nuget 内容文件不会被复制

python - 在 tomcat 上的 jython 下运行 cx_Oracle