2013-02-16 4 views
0

나는 말 그대로 글자를 찾지 못했습니다. py2exe에 대해서도 pyinstaller를 사용하고 싶습니다.Pyinstaller와 함께 Pymunk 사용

제 문제는 모듈 (pymunk [일명 Chipmunk])이 exe 빌드에 완전히 포함되어 있지 않다는 것입니다. 그것은 아마도 dll의 일종이 누락되었습니다. 근본적으로 그것의 의존성을 놓치고 나는 해결할 줄 몰라. 지금까지 이러한 메시지는 컴파일되는 것 가정 것 다람쥐에서 갈 수 있도록

Failed to load pymunk library. 

This error usually means that you don't have a compiled version of chipmunk in 
the correct spot where pymunk can find it. pymunk does not include precompiled 
chipmunk library files for all platforms. 

The good news is that it is usually enough (at least on *nix and OS X) to 
simply run the compile command first before installing and then retry again: 

You compile chipmunk with 
> python setup.py build_chipmunk 
and then continue as usual with 
> python setup.py install 
> cd examples 
> python basic_test.py 

(for complete instructions please see the readme file) 

If it still doesnt work, please report as a bug on the issue tracker at 
http://code.google.com/p/pymunk/issues 
Remember to include information about your OS, which version of python you use 
and the version of pymunk you tried to run. A description of what you did to 
trigger the error is also good. Please include the exception traceback if any 
(usually found below this message). 

Traceback (most recent call last): 
    File "<string>", line 2, in <module> 
    File "C:\python26\lib\site-packages\PyInstaller\loader\iu.py", line 386, in importHook 
    mod = _self_doimport(nm, ctx, fqname) 
    File "C:\python26\lib\site-packages\PyInstaller\loader\iu.py", line 480, in doimport 
    exec co in mod.__dict__ 
    File ".\build\pyi.win32\CollisionUtil\out00-PYZ.pyz\pymunk", line 53, in <module> 
    File "C:\python26\lib\site-packages\PyInstaller\loader\iu.py", line 431, in importHook 
    mod = self.doimport(nm, ctx, ctx + '.' + nm) 
    File "C:\python26\lib\site-packages\PyInstaller\loader\iu.py", line 480, in doimport 
    exec co in mod.__dict__ 
    File ".\build\pyi.win32\CollisionUtil\out00-PYZ.pyz\pymunk._chipmunk", line 14, in <module> 
    File ".\build\pyi.win32\CollisionUtil\out00-PYZ.pyz\pymunk.libload", line 68, in load_library 
    File ".\build\pyi.win32\CollisionUtil\out00-PYZ.pyz\ctypes", line 431, in LoadLibrary 
    File ".\build\pyi.win32\CollisionUtil\out00-PYZ.pyz\ctypes", line 353, in __init__ 
WindowsError: [Error 126] The specified module could not be found 

다람쥐 도서관은하는 ctypes 모듈을 통해 포장했다. 파이썬 관점에서 도움이되지 않습니다. 아마.

아무도 pyinstaller에 대한이 종속성을 해결하는 방법을 알려 줄 수 있습니까?

답변

3

당신은 chipmunk.dll 파일을 포함해야합니다 (그리고 osx에서 .dylib 파일을 실행하고 linux에서 .so 파일을 실행하려면). 빠른 해킹 옵션은 생성 된 .exe 파일이있는 위치로 수동으로 복사하는 것입니다. 다른 옵션은 pyinstaller가이를 포함하도록하는 것입니다. 나는 pyinstaller의 전문가는 아니지만 pyinstaller가 생성하는 .spec 파일을 편집하는 방법 중 하나입니다. 같은

뭔가 :

import os, pymunk 
pymunk_dir = os.path.dirname(pymunk.__file__) 
chipmunk_libs = [ 
    ('chipmunk.dll', os.path.join(pymunk_dir, 'chipmunk.dll'), 'DATA'), 
] 
#... 
coll = COLLECT(exe, 
       a.binaries + chipmunk_libs, 
       a.zipfiles, 
       a.datas, 
       strip=None, 
       upx=True, 
       name=os.path.join('dist', 'basic_test')) 

나는 전체 예제를 작성 트렁크를 pymunk하는 데 최선을 다하고 있습니다. https://github.com/viblo/pymunk/blob/master/examples/pyinstaller_basic_test.spec을보십시오 (이 예제는 처음에는 sys.path.insert (0, '..')를 수행하는 경로 해커가 약간 있음을 유의하십시오. 프로그램이 이미 pymunk를 찾을 수 있고, 파일을 같은 위치에 두지 않아도됩니다.

+0

LOL 내가 찾던 dll을 찾았 으면이 질문을 게시하지 않았을 것입니다. 결론에 도달 했으므로 방금 찾았습니다. StackExchance 업데이트 XD 확인하기 전에. exe 옆에 넣어 모든 잘 있습니다.이 예제를 주셔서 감사합니다 확실히 그것을 시도 줄 것이다. – Kaliber64