正常情况下:
将ui文件编译为py文件:
pyuic5 -o Ui_xaj.py xaj.ui
将qrc文件编译为py文件:
pyrcc5 -o xaj_rc.py xaj.qrc
问题描述:
- PyQt5、PyQt5-sip已安装
- pyuic5命令正常运行:
pyrcc5时出现报错:
Error: Command failed: "pyrcc5" "e:\VScode_projects\xaj_model\xaj.qrc" -o "e:\VScode_projects\xaj_model\xaj_rc.py"
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyQt5\pyrcc_main.py", line 23, in <module>
from .pyrcc import *
ImportError: DLL load failed: The specified procedure could not be found.
解决步骤:
-
确定当前环境:
环境: C:\ProgramData\Anaconda3
C:\ProgramData\Anaconda3\Scripts下未发现pyrcc5.exe
- 下载对应版本的pyrcc5.exe到C:\ProgramData\Anaconda3\Scripts:
https://www.pconlife.com/viewfileinfo/pyrcc5-exe/
-
验证
git bash 中可以正常使用
PowerShell 还是存在问题
网友评论