首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pyinstaller + PySide6 --警告:文件已经存在,但不应该存在:

pyinstaller + PySide6 --警告:文件已经存在,但不应该存在:
EN

Stack Overflow用户
提问于 2021-10-31 21:46:42
回答 1查看 483关注 0票数 1

当我编译我的应用程序时,我得到了类似的问题,如here所述

我的警告如下所示:

代码语言:javascript
复制
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtCore.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtGui.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtNetwork.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtOpenGL.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtPrintSupport.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtQml.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtQuick.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtWebEngineCore.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtWebEngineWidgets.pyd
[18136] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI181362\PySide6\QtWidgets.pyd

受其他帖子的回答的启发,我在规范文件中添加了以下代码:

代码语言:javascript
复制
to_remove = ["QtCore.pyd", "QtGui.pyd", "QtNetwork.pyd", 
             "QtOpenGL.pyd","QtPrintSupport.pyd", "QtQml.pyd", \
             "QtQuick.pyd", "QtWebEngineCore.pyd","QtWebEngineWidgets.pyd", \
             "QtWidgets", "QtOpenGL.pyd"]

to_remove_alt = ["PySide6.QtQuick", "PySide6.QtNetwork", "PySide6.QtPrintSupport", 
                 "PySide6.QtCore", "PySide6.QtWebEngineWidgets", \
                 "PySide6.QtQml", "PySide6.QtGui", "PySide6.QtWidgets", 
                 "PySide6.QtOpenGL", 
                 "PySide6.QtWebEngineCore", "PySide6.QtNetwork"]



for b in a.binaries:
      if str(b[1]).rsplit("\\",1)[1] not in to_remove:
          pass
      else:
          print("removed " + b[1])
          a.binaries.remove(b)

    
for b in a.binaries:
      if b[0] not in to_remove_alt:
          pass
      else:
          print("removed " + b[0])
          a.binaries.remove(b)

哪种输出

代码语言:javascript
复制
removed c:\digikwondo\project\venv\lib\site-packages\PySide6\QtQuick.pyd
removed c:\digikwondo\project\venv\lib\site-packages\PySide6\QtOpenGL.pyd
removed c:\digikwondo\project\venv\lib\site-packages\PySide6\QtPrintSupport.pyd
removed c:\digikwondo\project\venv\lib\site-packages\PySide6\QtCore.pyd
removed c:\digikwondo\project\venv\lib\site-packages\PySide6\QtWebEngineWidgets.pyd
removed PySide6.QtNetwork
removed PySide6.QtGui
removed PySide6.QtWidgets

现在,当我启动应用程序时,仍然会收到这些警告

代码语言:javascript
复制
[1772] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI17722\PySide6\QtQml.pyd
[1772] WARNING: file already exists but should not: 
C:\Users\digikwondo\AppData\Local\Temp\_MEI17722\PySide6\QtWebEngineCore.pyd

为什么最后两个文件(QtQml.pyd, QtWebEngineCore.pyd)没有被删除?(尽管在我的列表中)

我是不是漏掉了什么?

我的平台:

代码语言:javascript
复制
PyInstaller: 4.5.1
Python: 3.9.2
Platform: Windows-10-10.0.19041-SP0

已安装的包

代码语言:javascript
复制
Package                   Version
------------------------- ---------
altgraph                  0.17.2
auto-py-to-exe            2.10.1
bottle                    0.12.19
bottle-websocket          0.2.9
certifi                   2021.10.8
cffi                      1.15.0
charset-normalizer        2.0.7
cycler                    0.10.0
docopt                    0.6.2
Eel                       0.12.4
future                    0.18.2
gevent                    21.8.0
gevent-websocket          0.10.1
greenlet                  1.1.2
gunicorn                  20.1.0
idna                      3.3
Jinja2                    3.0.2
json2html                 1.3.0
kiwisolver                1.3.2
MarkupSafe                2.0.1
matplotlib                3.4.3
matplotlibqml             0.92.2
numpy                     1.21.3
pandas                    1.3.4
pefile                    2021.9.3
Pillow                    8.4.0
pip                       21.3.1
psutil                    5.8.0
pycparser                 2.20
pycryptodomex             3.11.0
pyinstaller               4.5.1
pyinstaller-hooks-contrib 2021.3
pyparsing                 3.0.1
pypiwin32                 223
PySide6                   6.2.0
python-dateutil           2.8.2
pytz                      2021.3
pywin32                   302
pywin32-ctypes            0.2.0
pyzipper                  0.3.5
requests                  2.26.0
setuptools                57.0.0
shiboken6                 6.2.0
six                       1.16.0
tinyaes                   1.0.1
tornado                   6.1
urllib3                   1.26.7
wheel                     0.36.2
whichcraft                0.6.1
yarg                      0.1.9
zope.event                4.5.0
zope.interface            5.4.0
EN

回答 1

Stack Overflow用户

发布于 2021-11-01 10:20:36

在经过大量的试验和错误之后,spec文件中的以下代码似乎已经完成了任务!

代码语言:javascript
复制
to_rem = ["PySide6.QtQuick", "PySide6.QtNetwork", "PySide6.QtPrintSupport", 
          "PySide6.QtCore", "PySide6.QtWebEngineWidgets", \
          "PySide6.QtQml", "PySide6.QtGui", "PySide6.QtWidgets", 
          "PySide6.QtOpenGL", "PySide6.QtWebEngineCore", 
          "PySide6.QtNetwork"]
      

for val in to_rem:
    for b in a.binaries:
          nb = b[0]
          if str(nb).endswith(val):
                print("removed  " + b[0])
                a.binaries.remove(b)

现在,我的应用程序启动并运行良好。

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

https://stackoverflow.com/questions/69790852

复制
相关文章

相似问题

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