为了更新Qt (.ui文件)中的任何更改,需要运行pyuic4.bat文件。这将更新.py文件中的代码,使其反映Qt中所做的更改。
通常运行这两行代码,就完成了任务。第一行将目录更改为我的.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发布于 2017-04-17 18:56:31
我们不可能知道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 %9https://stackoverflow.com/questions/43448074
复制相似问题