파이썬 프로젝트를 UNIX 실행 파일로 패키지하고 싶습니다. 이를 위해 py2exe, cxfreeze 및 pyInstaller를 시도했지만 아무 것도 작동하지 않았습니다. 다행히 pyinstaller로 나를 도울 수 있기를 바랍니다. 그래서 여기에 간다 :pyInstaller executable missing module "_struct"on Ubuntu 12.04 Precise
나는 http://www.pyinstaller.org/에서 pyinstaller-2.0의 zip 파일을 다운로드하여 압축을 푼다.
폴더에서 나는 python pyinstaller.py ../helloworld.py
(끝에 출력)을 실행합니다. 나에게 출력을 제공 ./helloworld/dist/helloworld/helloworld
:
mod is NULL - structTraceback (most recent call last):
File "/usr/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
mod is NULL - archiveTraceback (most recent call last):
File "/home/jelle/Downloads/pyinstaller-1.5.1/archive.py", line 42, in <module>
import struct
ImportError: No module named struct
Traceback (most recent call last):
File "<string>", line 25, in <module>
ImportError: No module named archive
내가 파이썬 2.7.3와 우분투 12.04를 사용하고
는 그럼 난 파일을 실행하려고합니다. 내 PYTHONPATH는 /usr/lib/python2.7을 포함합니다. 문제가 _struct 모듈이 누락 된 것처럼 보이지만 어디에서 찾을 수 있는지 잘 모릅니다. pyinstaller 1.5.1 및 개발 버전을 사용해 보았지만 여기서도 작동하지 않습니다.
도와주세요!
python pyinstaller.py ../helloworld.py
의 출력 :
7 INFO: wrote /home/jelle/Downloads/pyinstaller-2.0/helloworld/helloworld.spec
27 INFO: UPX is not available.
583 INFO: checking Analysis
583 INFO: building Analysis because out00-Analysis.toc non existent
583 INFO: running Analysis out00-Analysis.toc
702 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/support/_pyi_bootstrap.py
1570 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/archive.py
1637 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/carchive.py
1701 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/iu.py
1720 INFO: Analyzing ../helloworld.py
1721 INFO: Hidden import 'encodings' has been found otherwise
1721 INFO: Looking for run-time hooks
1721 INFO: Analyzing rthook /home/jelle/Downloads/pyinstaller-2.0/support/rthooks/pyi_rth_encodings.py
2197 INFO: Looking for Python library libpython2.7.so
objdump: section '.dynamic' mentioned in a -j option, but not found in any input file
2308 INFO: Warnings written to /home/jelle/Downloads/pyinstaller-2.0/helloworld/build/pyi.linux2/helloworld/warnhelloworld.txt
2311 INFO: checking PYZ
2311 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
2312 INFO: building PYZ out00-PYZ.toc
2706 INFO: checking PKG
2706 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
2706 INFO: building PKG out00-PKG.pkg
2711 INFO: checking EXE
2712 INFO: rebuilding out00-EXE.toc because helloworld missing
2712 INFO: building EXE from out00-EXE.toc
2772 INFO: Appending archive to EXE /home/jelle/Downloads/pyinstaller-2.0/helloworld/build/pyi.linux2/helloworld/helloworld
2773 INFO: checking COLLECT
2773 INFO: building COLLECT out00-COLLECT.toc
가 BTW : 내 helloworld.py 단순히 문 인쇄에 "Hello World"를 포함하고 있습니다. #!/usr/bin/python2.7을 맨 위에 두어 보았습니다. 시스템 변수 LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
의 값이 그것은 잘못된 파이썬 라이브러리 libpython2.7.so를 가리킬 수