2014-09-25 39 views
1

我想把我的GUI變成一個可執行文件使用Pyinstaller。 GUI使用vpython,matplotlib和其他一些標準的python庫,我檢查過我可以使用python在命令控制檯中導入所有的模塊。我建設使用的命令,PyInstaller 2.1 IOError

python pyinstaller.py -p C:\Python27\Lib\site-packages GUI.py 

該方案建立,但是當我嘗試運行它,我感到我真的不理解的錯誤。

Traceback (most recent call last): 
    File "<string>", line 7, in <module> 
    File "C:\Users\James\Desktop\PyInstaller-2.1\PyInstaller\loader\pyi_importers. 
py", line 270, in load_module 
    exec(bytecode, module.__dict__) 
    File "C:\Users\James\Desktop\PyInstaller-2.1\GUI\build\GUI\out00-PYZ.pyz\visua 
l", line 4, in <module> 
    File "C:\Users\James\Desktop\PyInstaller-2.1\PyInstaller\loader\pyi_importers. 
py", line 270, in load_module 
    exec(bytecode, module.__dict__) 
    File "C:\Users\James\Desktop\PyInstaller-2.1\GUI\build\GUI\out00-PYZ.pyz\visua 
l_common.create_display", line 35, in <module> 
    File "C:\Users\James\Desktop\PyInstaller-2.1\PyInstaller\loader\pyi_importers. 
py", line 270, in load_module 
    exec(bytecode, module.__dict__) 
    File "C:\Users\James\Desktop\PyInstaller-2.1\GUI\build\GUI\out00-PYZ.pyz\visua 
l_common.materials", line 159, in <module> 
    File "C:\Users\James\Desktop\PyInstaller-2.1\GUI\build\GUI\out00-PYZ.pyz\visua 
l_common.materials", line 129, in loadTGA 
IOError: [Errno 2] No such file or directory: 'C:\\Users\\James\\Desktop\\PYINST 
~1.1\\GUI\\dist\\GUI\\visual_common/turbulence3.tga' 
swig/python detected a memory leak of type 'wxPlatformInfo *', no destructor fou 
nd. 
C:\Users\James\Desktop\PyInstaller-2.1\GUI\dist\GUI> 

任何幫助表示讚賞。

+0

您可以右鍵單擊該命令的輸出,彰顯您的鼠標,然後複製並粘貼到此處;而不是將截圖難以解析,因爲輸出被截斷。 – 2014-09-25 09:20:39

回答

0

我能看完解決這個問題,

http://osdir.com/ml/python-visualpython-user/2009-07/msg00039.html

的文藝青年最愛的是,有在Vpython materials.py一些代碼,設置紋理路徑,

if hasattr(sys,'frozen') and (sys.frozen=="windows_exe" or sys.frozen=="console_exe"): 
    texturePath="visual\\" 
else: 
    texturePath = os.path.split(__file__)[0] + "/" 
del sys 

我評論了這一點,並用靜態路徑替換它。然後我將Vpython的tga文件複製到此路徑中。有可能是一個更優雅的解決方案,但這種解決方法對我來說很好。

0

我定這樣的:

#texturePath="visual\\" --> texturePath="visual_common\\" 

#texturePath = os.path.split(__file__)[0] + "/" --> 
texturePath="C:\Python27\Lib\site-packages\\visual_common\\" 

問候