我正在尝试使用 clr.AddReference 将 sqlite3 功能添加到我正在编写的简单 IronPython 程序中;但每次我尝试引用 System.Data.SQLite 我都会收到此错误:
Traceback(最近一次调用最后一次):文件“”,第 1 行,在 IOError:System.IO.IOException:无法
在 Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call 中添加对程序集 System.Data.SQLite 的引用( Object[] args, Boolean&shouldOptimize)
at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller 4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at CallSite.Target(Closure , CallSite , CodeContext , Object , Object )
at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Runtime.FunctionCode.Call(CodeContext context)
at IronPython.Runtime.Operations.PythonOps.QualifiedExec(CodeContext context, Object code, PythonDictionary globals, Object locals)
at Microsoft.Scripting.Interpreter.ActionCallInstruction
我一直在主要测试解释器中的导入和引用,这些是我测试的行:
import sys
import clr
sys.path.append("C:/Program Files (x86)/SQLite.NET/bin")
clr.AddReference("System.Data.SQLite")
输入 clr.AddReference 行后发生错误。如何正确添加 System.Data.SQLite?