我正在尝试使用PyInstaller构建简单的PyQT应用程序。以下是我的代码:
import sys from PyQt4.QtGui import QApplication, QMessageBox
def main():
print "Hello"
a = QApplication(sys.argv)
m = QMessageBox(QMessageBox.Information, "Title", "Hello")
m.exec_()
if __name__=="__main__":
main()
我使用以下命令生成specfile:
python utils/Makespec.py scigraph/main.py
我得到了以下输出:
→ python utils/Makespec.py scigraph/main.py
wrote /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/main/main.spec
now run pyinstaller.py to build the executable
然后我运行了这段代码:
python pyinstaller.py --windowed main/main.spec
我发现以下错误消息:
→ python pyinstaller.py --windowed main/main.spec
51 WARNING: You are running 64-bit Python: created binaries will only work on Mac OS X 10.6+.
If you need 10.4-10.5 compatibility, run Python as a 32-bit binary with this command:
VERSIONER_PYTHON_PREFER_32_BIT=yes arch -i386 /Users/vessilli/Library/Enthought/Canopy_64bit/User/bin/python
4062 INFO: UPX is not available.
4096 INFO: Processing hook hook-os
4253 INFO: Processing hook hook-time
4311 INFO: Processing hook hook-_sre
4354 INFO: Processing hook hook-cStringIO
4367 INFO: Processing hook hook-codecs
4383 INFO: Processing hook hook-encodings
5107 INFO: Processing hook hook-cPickle
5283 INFO: Extending PYTHONPATH with /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/scigraph
5284 INFO: checking Analysis
5284 INFO: building Analysis because out00-Analysis.toc non existent
5284 INFO: running Analysis out00-Analysis.toc
5309 INFO: Analyzing /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/_pyi_bootstrap.py
5334 INFO: Processing hook hook-os
5362 INFO: Processing hook hook-site
5387 INFO: Processing hook hook-encodings
5531 INFO: Processing hook hook-time
5587 INFO: Processing hook hook-_sre
5625 INFO: Processing hook hook-cStringIO
5640 INFO: Processing hook hook-codecs
6325 INFO: Processing hook hook-cPickle
6539 INFO: Processing hook hook-pydoc
6741 INFO: Processing hook hook-email
6822 INFO: Processing hook hook-httplib
6869 INFO: Processing hook hook-email.message
7284 INFO: Analyzing /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py
7371 INFO: Analyzing /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_archive.py
7445 INFO: Analyzing /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_carchive.py
7519 INFO: Analyzing /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_os_path.py
7527 INFO: Analyzing scigraph/main.py
7538 ERROR: Cannot find qt_menu.nib directory
7538 INFO: Processing hook hook-PyQt4
7540 INFO: Processing hook hook-PyQt4.QtGui
8166 INFO: Processing hook hook-PyQt4.QtCore
8268 INFO: Hidden import 'codecs' has been found otherwise
8268 INFO: Hidden import 'encodings' has been found otherwise
8268 INFO: Looking for run-time hooks
8269 INFO: Analyzing rthook /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/rthooks/pyi_rth_qt4plugins.py
8392 ERROR: Can not find path ./lib/QtCore.framework/Versions/4/QtCore (needed by /Users/vessilli/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PyQt4/QtCore.so)
8463 ERROR: Can not find path ./lib/QtCore.framework/Versions/4/QtCore (needed by /Users/vessilli/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PyQt4/QtGui.so)
8463 ERROR: Can not find path ./lib/QtGui.framework/Versions/4/QtGui (needed by /Users/vessilli/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PyQt4/QtGui.so)
8634 INFO: Using Python library /Users/vessilli/Library/Enthought/Canopy_64bit/User/bin/Python
8672 INFO: Warnings written to /Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/main/build/main/warnmain.txt
8684 INFO: checking PYZ
8684 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
8684 INFO: building PYZ (ZlibArchive) out00-PYZ.toc
10044 INFO: checking PKG
10045 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
10045 INFO: building PKG (CArchive) out00-PKG.pkg
Traceback (most recent call last):
File "pyinstaller.py", line 18, in <module>
run()
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/main.py", line 46, in run_build
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 1873, in build
execfile(spec)
File "main/main.spec", line 15, in <module>
console=True )
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 1170, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 1008, in __init__
self.__postinit__()
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 309, in __postinit__
self.assemble()
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/build.py", line 1069, in assemble
archive.build(self.name, mytoc)
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_archive.py", line 217, in build
self._finalize()
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_carchive.py", line 191, in _finalize
self.save_cookie(toc_pos)
File "/Users/vessilli/Desktop/untitled folder/pywork/PyInstaller-2.1/PyInstaller/loader/pyi_carchive.py", line 367, in save_cookie
tocpos, self.toclen, pyvers, self._pylib_name)
struct.error: argument for 's' must be a string
我正在运行Mac OSX 10.9.4。我的Python版本信息是:
Enthought Canopy Python 2.7.3 | 64-bit | (default, Aug 8 2013, 05:37:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
有人已经遇到过这样的问题吗?任何提示或建议都会很明显。