我试图编译PyQt4和Matplotlib的麻烦似乎无穷无尽。
这是我的测试计划test.py
from PyQt4 import QtGui, QtCore
import math
import sys
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
import matplotlib.pyplot as plt
这是我尝试通过命令行冻结此文件
pyinstaller -w --onefile test.py
(没有选项测试 - pyinstaller test.py
- 结果相同)
这是我的控制台输出:
16 INFO: wrote C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alpha\test.spec
30 INFO: Testing for ability to set icons, version resources...
46 INFO: ... resource update available
62 INFO: UPX is not available.
78 INFO: Processing hook hook-os
171 INFO: Processing hook hook-time
171 INFO: Processing hook hook-cPickle
233 INFO: Processing hook hook-_sre
328 INFO: Processing hook hook-cStringIO
405 INFO: Processing hook hook-encodings
421 INFO: Processing hook hook-codecs
717 INFO: Extending PYTHONPATH with C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alph
a
717 INFO: checking Analysis
796 INFO: checking PYZ
826 INFO: checking PKG
826 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
826 INFO: building PKG (CArchive) out00-PKG.pkg
Traceback (most recent call last):
File "C:\Python27\Scripts\pyinstaller-script.py", line 9, in <module>
load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 46, in run_buil
d
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1873, in build
execfile(spec)
File "C:\Users\Tyson\Desktop\PHS3031 Lab1.2 - Alpha\test.spec", line 17, in <m
odule>
console=False )
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1170, in __ini
t__
strip_binaries=self.strip, upx_binaries=self.upx,
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1008, in __ini
t__
self.__postinit__()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 309, in __post
init__
self.assemble()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1050, in assem
ble
dist_nm=inm)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 842, in checkC
ache
digest = cacheDigest(fnm)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 796, in cacheD
igest
data = open(fnm, "rb").read()
IOError: [Errno 22] invalid mode ('rb') or filename: ''
我试图在Windows 7上使用Python 2.7执行此操作。
似乎有一些空字符串,它应该是一个文件名,但是这个错误显然存在于我的代码之外。
任何和所有帮助表示赞赏。
谢谢,
泰森
答案 0 :(得分:-1)
看起来PyInstaller遇到了缓存问题,它每次都不会读取所有源文件。
在%Appdata%文件夹中是一个pyinstaller文件夹,用于将缓存存储在bincache *文件夹中。也许它有助于清理缓存并再次尝试运行pyinstaller