2015-03-13 66 views
1

我的頭痛試圖編譯PyQt4和Matplotlib看起來相當無窮。通過pyinstaller編譯與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

你嘗試更新pywin32,它看起來像蛋版本可能會導致問題(2例) – denfromufa 2015-03-19 22:46:11

+0

我更新pywin32與pip最初沒有運氣 – 2015-03-19 23:07:11

+0

沒有問題我的機器,看到完整的輸出https://www.dropbox.com/s/hvp1hfq381j0i9h/test1.txt?dl=0 – denfromufa 2015-03-21 06:37:01

回答

-1

它看起來像PyInstaller是有與它使用不讀取所有sourcefiles每次緩存的問題。

在%Appdata%文件夾中是一個將緩存存儲在bincache *文件夾中的pyinstaller文件夾。也許它有助於清理緩存,並再次嘗試運行pyinstaller

+0

沒有任何影響 – 2015-03-23 00:16:00