尝试使用IronPython运行用C#/ Mono编写的简单控制台应用程序时出现问题。当我在Windows 7 SP1 64位上运行它时,它绝对没有问题。但是,当我尝试在安装了最新的Mono版本之一的Ubuntu上运行它时(我之前已成功测试了许多C#/ Mono应用程序),它将无法运行。我使用MONO_LOG_LEVEL=debug
收到的完整调试在此文本下面:
tomsontom@ubuntu:~$ MONO_LOG_LEVEL=debug mono '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe'
Mono: gc took 75 usecs
Mono: Assembly Loader probing location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Image addref mscorlib[0xd14930] -> /usr/lib/mono/4.0/mscorlib.dll[0xd13cb0]: 2
Mono: AOT failed to load AOT module /usr/lib/mono/4.0/mscorlib.dll.so: /usr/lib/mono/4.0/mscorlib.dll.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Config attempting to parse: '/usr/lib/mono/4.0/mscorlib.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono: Assembly mscorlib[0xd14930] added to domain IronPythonConsole.exe, ref_count=1
Mono: Config attempting to parse: '/etc/mono/config'.
Mono: Config attempting to parse: '/home/tomsontom/.mono/config'.
Mono: Assembly Loader probing location: '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe'.
Mono: Image addref IronPythonConsole[0xd91670] -> /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe[0xd12b70]: 3
Mono: Assembly IronPythonConsole[0xd91670] added to domain IronPythonConsole.exe, ref_count=1
Mono: AOT failed to load AOT module /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.so: /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe'.
Mono: Config attempting to parse: '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/IronPythonConsole/IronPythonConsole.config'.
Mono: Assembly Loader probing location: '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe'.
Mono: AOT failed to load AOT module /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.so: /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Ref addref IronPythonConsole[0xd91670] -> mscorlib[0xd14930]: 2
Mono: Config attempting to parse: '/mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe.config'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/Microsoft.Scripting/1.1.0.20__7f709c5b713576e1/Microsoft.Scripting.dll'.
Mono: Assembly Loader probing location: '/mnt/hgfs/Mono Shared/ironpython/Microsoft.Scripting.dll'.
Mono: Assembly Loader probing location: '/usr/lib/Microsoft.Scripting.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/Microsoft.Scripting/1.1.0.20__7f709c5b713576e1/Microsoft.Scripting.exe'.
Mono: Assembly Loader probing location: '/mnt/hgfs/Mono Shared/ironpython/Microsoft.Scripting.exe'.
Mono: Assembly Loader probing location: '/usr/lib/Microsoft.Scripting.exe'.
Mono: The following assembly referenced from /mnt/hgfs/Mono Shared/ironpython/IronPythonConsole.exe could not be loaded:
Assembly: Microsoft.Scripting (assemblyref_index=2)
Version: 1.1.0.20
Public Key: 7f709c5b713576e1
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/mnt/hgfs/Mono Shared/ironpython/).
Mono: Failed to load assembly IronPythonConsole[0xd91670]
Mono: Could not load file or assembly 'Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies.
File name: 'Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies.
File name: 'Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1'
正如您所看到的,Mono抱怨Microsoft.Scripting
库。但是,它与可执行文件位于同一目录中!我也尝试过复制其他一些库,但没有任何帮助。现在,这些文件位于同一个文件夹中:
IronPython.dll
IronPython.Modules.dll
IronPythonConsole.exe
Microsoft.Dynamic.dll
Microsoft.Scripting.dll
Microsoft.Scripting.Metadata.dll
这可能是什么问题?我已经读过IronPython应该在没有任何问题的情况下使用Mono。谢谢你的帮助!