python - 如何解决 cx_freeze 错误:_ 和_ 是同一个文件?
问题描述
我试图将我的 pyqt5 应用程序转换为 exe。我正在使用 cx_freeze 这样做。我按照 cx_freeze 的要求创建了 setup.py 文件并运行python setup.py build
命令来生成 exe。如图所示,在构建阶段似乎存在一些错误。显示错误:
creating directory build\exe.win-amd64-3.9\lib
copying data from package PyQt5...
copying Z:\translator\lib\site-packages\PyQt5\QtCore.pyd -> build\exe.win-amd64-3.9\lib\PyQt5\QtCore.pyd
copying C:\Users\Rishabh\AppData\Local\Programs\Python\Python39\python3.dll -> build\exe.win-amd64-3.9\lib\PyQt5\python3.dll
copying Z:\translator\lib\site-packages\PyQt5\Qt5\bin\Qt5Core.dll -> build\exe.win-amd64-3.9\lib\PyQt5\Qt5Core.dll
copying Z:\translator\lib\site-packages\PyQt5\QtGui.pyd -> build\exe.win-amd64-3.9\lib\PyQt5\QtGui.pyd
copying Z:\translator\lib\site-packages\PyQt5\Qt5\bin\Qt5Gui.dll -> build\exe.win-amd64-3.9\lib\PyQt5\Qt5Gui.dll
copying Z:\translator\lib\site-packages\PyQt5\QtWidgets.pyd -> build\exe.win-amd64-3.9\lib\PyQt5\QtWidgets.pyd
error: WindowsPath('Z:/translator/lib/site-packages/PyQt5/QtWidgets.pyd') and WindowsPath('build/exe.win-amd64-3.9/lib/PyQt5/QtWidgets.pyd') are the same file.
cx_freeze 从虚拟环境中复制 QtWidget.pyd 文件,然后引发两个文件相同的错误。这个问题怎么解决??
解决方案
卸载您首先运行的内容
然后检查文件WindowsPath('build/exe.win-amd64-3.9/lib/PyQt5/QtWidgets.pyd')
路径中已经存在的完全相同。
我认为它可能存在于文件系统中
\src\Application\build/exe.win-amd64-3.9/lib/PyQt5/QtWidgets.pyd
如果存在,请删除该文件并重新安装
推荐阅读
- java - Gson.toJson 返回 null [ProGuard 问题]
- python - Python inspect.stack() 的 code_context 只返回一行上下文
- r - 有没有办法在 mutate 中索引不同的列、变量和函数?
- reactjs - 使用 HOC 作为 React 组件
- azure - 无法获取 Azure 键值机密值
- c++ - 创建用于编译 c++ 的通用简单 Makefile
- google-app-maker - 从单个搜索框查询 Google AppMaker 中的多个数据源
- java - 我使用 FileHandler 创建了一个记录器类来将日志写入文件,但它只是打印到控制台
- sql - 将列的默认值添加为另一列值的 Base64Encoding
- python - lxml / scrapy选择器可以不传输html实体吗