#问题说明 PyQt5 5.15版本下,在Win10里打开Qtdesigner.exe主界面正常,但如果打开文件夹选文件会出现python停止导致程序退出,这或许应该是5.15版本的bug之一,5.14.2就没有。相应的调用文件对话框QFileDialog也会有出现类似问题。
#解决方案 1、PyQt5 版本回转==》5.14.2
pip uninstall PyQt5 PyQt5-tools pip install PyQt5==5.14.2 PyQt5-tools=5.14.2.1.72、调用文件对话框QFileDialog时标记: QFileDialog.DontUseNativeDialog
def get_datafile(self): filename, filetype = QFileDialog.getOpenFileName(self, '選擇數據文件', 'F:\\', "Vertex file(*.txt *.ver)",None,QFileDialog.DontUseNativeDialog) self.__filename = filename print(filename, filetype) # show the selected file in FileName Text self.Filename.setText(filename)原因请看Stackflow上的分析:QFileDialog crash 3、其他已经发现问题 PS:Pycharmm+PyQt5下调用文件对话框QFileDialog没问题 选择安装的32位的Python解释器没问题。。。