<p>我对使用python解释器的c可执行文件中的tcl有一些问题。
由于某些原因,它无法加载<code><fullpath>Tix843.dll</code>。但是当直接(从python)运行python代码时,它确实可以工作。dll的路径/名称正确。。。
我只看到Tkinter试图加载tixdll,但是找不到它。。。在</p>
<p>在跟踪了tcl中的所有路径之后,我只能检测到1个差异:<code>nameofexecutable</code>。当直接从python运行时,它是<code>python.exe</code>的路径,但是当从c可执行文件运行它时,它(显然)是<code>path/name of the executable</code>。在</p>
<p>在tcl/tk中,我注意到<code>nameofexecutable</code>用于设置许多路径,因此我认为这是我的问题所在。在</p>
<p>我试图阻止这个问题:</p>
<ol>
<li>将dll的路径添加到系统路径</li>
<li>将dll的路径添加到<code>$auto_path</code>->;无更改</li>
<li>在调用PySys\u SetArgv->;no change之前,设置c可执行文件的<code>argv[0]</code></li>
</ol>
<p>我在做什么蠢事吗?或者我如何设置<code>nameofexecutable</code>?有没有其他方法可以解决这个问题。在</p>
<p>编辑:
再次检查了依赖性行者,现在我有了接力,不知道发生了什么。。。
结果如下:</p>
<pre><code>00:00:07.800: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x02468871.
00:00:07.800: Loaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000. Successfully hooked module.
00:00:07.816: Unloaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000.
00:00:07.816: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.832: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x0246889C.
00:00:07.832: Loaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000. Successfully hooked module.
00:00:07.832: Unloaded "c:\program files (x86)\python27\tcl\reg1.2\TCLREG12.DLL" at address 0x00440000.
00:00:07.832: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/reg1.2/tclreg12.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.925: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x02468871.
00:00:07.925: Loaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000. Successfully hooked module.
00:00:07.925: Unloaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000.
00:00:07.925: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.941: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\program files (x86)\python27\dlls\TCL85.DLL" at address 0x0246889C.
00:00:07.956: Loaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000. Successfully hooked module.
00:00:07.956: Unloaded "c:\program files (x86)\python27\tcl\tix8.4.3\TIX843.DLL" at address 0x04480000.
00:00:07.956: LoadLibraryExW("C:/Program Files (x86)/Python27/tcl/tix8.4.3/Tix843.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
00:00:07.956: LoadLibraryA("shell32") called from "c:\program files (x86)\python27\dlls\TK85.DLL" at address 0x024BBACD.
00:00:07.956: LoadLibraryA("shell32") returned 0x75480000.
</code></pre>
<p>因此,它有时可以找到DLL,但并不总是这样,然后失败</p>