0
我試圖使用pyinstaller從python文件創建單個文件的可執行文件。試圖import cups
時和可執行失敗提供了以下錯誤:使用pyinstaller捆綁pycups時發現圖像錯誤
Failed to execute script ImportPyCups
Traceback (most recent call last):
File "ImportPyCups.py", line 1, in <module>
import cups
File "/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "build/bdist.macosx-10.8-intel/egg/cups.py", line 7, in <module>
File "build/bdist.macosx-10.8-intel/egg/cups.py", line 6, in __bootstrap__
ImportError: dlopen(/var/folders/jp/8v0hvshd585dw9v_7bnlxsqh0000gn/T/_MEILQoRVs/cups.so, 2): image not found
這裏的蟒蛇文件(是的,只是一個單一的import語句):
import cups
下面是我運行打開命令Python文件到單個文件可執行:
$ /usr/local/bin/pyi-makespec --onefile --console ImportPyCups.py
$ pyinstaller ImportPyCups.spec
我然後運行:
$ dist/ImportPyCups
這是我在上面粘貼的錯誤信息。如果我只是從運行像下面的終端蟒蛇文件,沒有出現錯誤:
$ python ImportPyCups.py
這個運行在環境(Mac OS X的10.8.5):
PyInstaller: 3.2
Python: 2.7.2
Platform: Darwin-12.5.0-x86_64-i386-64bit
安裝的pycups是:
Metadata-Version: 1.0
Name: pycups
Version: 1.9.68
Summary: Python bindings for libcups
Home-page: http://cyberelk.net/tim/software/pycups/
Author: Tim Waugh
Author-email: [email protected]
License: GPLv2+
Location: /Library/Python/2.7/site-packages/pycups-1.9.68-py2.7-macosx-10.8-intel.egg
Requires:
Classifiers:
Intended Audience :: Developers
Topic :: Software Development :: Libraries :: Python Modules
License :: OSI Approved :: GNU General Public License (GPL)
Development Status :: 5 - Production/Stable
Operating System :: Unix
Programming Language :: C
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
從錯誤消息看來,有些東西是缺少的,但我一直沒能弄清楚是什麼。