我正在使用cx_Freeze將Python腳本轉換爲Windows可執行文件。我正在使用腳本目錄中的cxfreeze腳本。我希望由cxfreeze生成的可執行文件位於不同的目錄中,而.dll和.pyd則位於不同的目錄中。當我試圖把他們兩個人在不同的目錄中的.exe沒有工作,我得到了將.dll和.pyd文件保存在其他目錄中
The application has failed to start because python33.dll was not found. Try reinstalling to fix this problem
我知道這happends因爲可執行文件和(DLL的& .pyd的)位於不同的目錄中。有沒有辦法讓他們在不同的目錄?
我使用下面的命令生成可執行
C:\Python33\Scripts>cxfreeze C:\Users\me\Desktop\setup.py --target-name=setup.exe --target-dir=C:\Users\me\Desktop\new_dir
[爲什麼?](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem)這有什麼錯把可執行文件和DLL在同一目錄? – abarnert
無論如何,在Windows上,應用程序在'%PATH%'中查找DLL,其中包含'.',但不包含比如'../ Libs /'。你總是可以在可執行文件中寫一個.cmd包裝器,例如'PATH =%PATH%; ../ Libs',然後是'./Executable/MyApp.exe'...但通常這不是一個好主意。 – abarnert
您可以在initscript([示例])中修改環境變量(https://bitbucket.org/anthony_tuininga/cx_freeze/src/default/cx_Freeze/initscripts/ConsoleSetLibPath.py?at=default)),但我認爲它仍然會在運行initscript之前至少需要找到python33.dll。 –