首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >通过pyinstaller使用PyQt4编译matplotlib时出现奇怪的错误

通过pyinstaller使用PyQt4编译matplotlib时出现奇怪的错误
EN

Stack Overflow用户
提问于 2015-03-13 18:01:05
回答 1查看 452关注 0票数 1

尝试编译PyQt4和Matplotlib让我头疼得似乎没完没了。

下面是我的测试程序test.py

代码语言:javascript
运行
复制
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 -结果相同)

下面是我的控制台输出:

代码语言:javascript
运行
复制
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: ''

我正尝试在装有Python 2.7的Windows7上做到这一点。

似乎有一些应该是文件名的空字符串,但这个错误显然存在于我的代码之外。

任何和所有的帮助都是感恩的。

谢谢,

泰森

EN

回答 1

Stack Overflow用户

发布于 2015-03-22 18:38:30

看起来PyInstaller的缓存出现了问题,它并不是每次都读取所有的源文件。

在%Appdata%文件夹中是一个pyinstaller文件夹,该文件夹将缓存存储在bincache*文件夹中。也许清理缓存并再次尝试运行pyinstaller会有所帮助。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29029378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档