使用pyinstaller时丢失的dll文件
问题描述:
美好的一天!使用pyinstaller时丢失的dll文件
我使用python 3.5.2与qt5,pyqt5和sip14.8。 我也使用最新的pyinstaller bracnch(3.3.dev0 + g501ad40)。
我正在尝试为基本的Hello World程序创建一个exe文件。
from PyQt5 import QtWidgets
import sys
class newPingDialog(QtWidgets.QMainWindow):
def __init__(self):
super(newPingDialog, self).__init__()
self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("hello!")
self.show()
app = QtWidgets.QApplication(sys.argv)
GUI = newPingDialog()
sys.exit(app.exec_())
起初,我曾经得到关于crt-msi的一些错误。所以我重新安装了SDK和C++运行时并将它们添加到我的环境中。 但现在我不断收到关于失踪的DLL(qsvg,Qt5PrintSupport)
6296 WARNING: lib not found: Qt5Svg.dll dependency of C:\users\me\appdata\local\programs\python\python35\lib\site-pac
kages\PyQt5\Qt\plugins\imageformats\qsvg.dll
6584 WARNING: lib not found: Qt5Svg.dll dependency of C:\users\me\appdata\local\programs\python\python35\lib\site-pac
kages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
6992 WARNING: lib not found: Qt5PrintSupport.dll dependency of C:\users\me\appdata\local\programs\python\python35\lib
\site-packages\PyQt5\Qt\plugins\printsupport\windowsprintersupport.dll
7535 WARNING: lib not found: Qt5PrintSupport.dll dependency of c:\users\me\appdata\local\programs\python\python35\lib
\site-packages\PyQt5\QtPrintSupport.pyd
8245 INFO: Looking for eggs
8245 INFO: Using Python library c:\users\me\appdata\local\programs\python\python35\python35.dll
8246 INFO: Found binding redirects:
我检查和DLL文件都存在,其轨道设置错误。我也尝试手动将它们添加到我的dist文件夹,但它没有帮助。
我将非常感谢您的任何建议!
答
这可能更像是一个解决方法,Pyinstaller可能需要修复。
我发现--paths
参数指向包含Qt5Core.dll,Qt5Gui.dll等目录帮助
pyinstaller --paths C:\Python35\Lib\site-packages\PyQt5\Qt\bin hello.py
答
通常加入含unfound库--Path
参数指向目录解决了这个问题。如果使用PyInstaller 3.3dev,命令字符串解析可能会有问题。这通常发生在路径包含空格的情况下。在这种情况下,您可以修改PyInstaller生成的.spec
文件中的pathex
参数,然后使用PyInstaller运行它以构建可执行文件。
pyinstaller file_name.spec
希望这将尽快修复.....
'在你的exe文件中插入一个'dll'是很困难的。尝试添加'作为源'建设者的配置。从x导入y'不是''import x.y'或'import x.y as z'的东西' – dsgdfg