PyQt - pyuic4.bat错误“系统找不到指定的路径”

时间:2017-04-17 08:42:37

标签: python qt batch-file cmd pyqt

为了更新Qt Designer(.ui文件)中所做的任何更改,需要运行pyuic4.bat文件。这会更新.py文件中的代码,以便它反映在Qt Designer中所做的更改。

正常运行这两行代码,完成了这项工作。第一行将目录更改为我的.ui.py文件所在的位置。第二行运行pyuic4.bat文件,根据.py文件中的更改更新.ui文件。

cd C:\Users\blah\Documents\PythonScripts
C:\Users\blah\Anaconda2\Lib\site-packages\PyQt4\pyuic4 guitemplate.ui >> guicode.py

但突然之间,我今天收到了这个错误:The system cannot find the path specified。我还尝试以管理员身份运行cmd。如果有帮助,我正在使用Anaconda。可能是什么问题?

这是pyuic4.bat文件

中包含的代码
@"C:\aroot\stage\python" "C:\aroot\stage\Lib\site-packages\PyQt4\uic\pyuic.py" %1 %2 %3 %4 %5 %6 %7 %8 %9

1 个答案:

答案 0 :(得分:1)

我们不可能知道guitemplate.ui应该位于何处。如果它与bat文件一起使用:

CD/D "%UserProfile%\Anaconda2\Lib\site-packages\PyQt4"
pyuic4.bat -x guitemplate.ui -o "%UserProfile%\Documents\PythonScripts\guicode.py"

如果它与预期的输出文件并排,则使用:

CD/D "%UserProfile%\Documents\PythonScripts"
"%UserProfile%\Anaconda2\Lib\site-packages\PyQt4\pyuic4.bat" -x guitemplate.ui -o guicode.py

如果上述方法不起作用,那么您可能需要更改pyuic4.bat的内容以匹配可能更改的python文件夹路径,例如

@"C:\Anaconda2\python" "C:\Anaconda2\Lib\site-packages\PyQt4\uic\pyuic.py" %1 %2 %3 %4 %5 %6 %7 %8 %9
相关问题