親測解決DLL load failed while importing QtGui: The specified module could not be found.


本來已經把GUI給做好了,下載一個pyqt5-tools准備用里面的qt designer優化界面時,環境有一些改變,導致這個問題。解決辦法是用conda prompt打開,或刪除環境重新配置,具體步驟如下。

背景

環境配置:Anaconda + python3.9 + win10

問題原因

conda里面自帶了qt-tools配套的pyqt5版本,直接pip install pyqt5-tools導致下載了一個沖突的pyqt5版本。
請添加圖片描述
另外,直接用cmd調用code .打開vscode會出現激活conda環境失敗的bug,也會導致這個問題。

conda activate S:\Anaconda3\envs\pyqt
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:1
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

解決方案

方法一

用conda prompt activate環境後再用調用ide,如code .。不行就用方法二。

請添加圖片描述

請添加圖片描述

方法二

刪除環境,重新配置,注意python版本選你自己的,有requirment可以直接下載,沒有直接跳過

conda env remove -n xxx
conda create -n xxx python=3.9
pip install -r requriements.txt

我的requirments.txt部分包如下:

six
tqdm
onnx
numpy
imgaug
einops
pandas

對於pyqt5,進入anaconda navigator搜索下載。這里需要下載pyqt5和qtpy。
請添加圖片描述
記住不要用pip install 在conda環境下下載pyqt的qt designer!

使用qt designer

直接輸入回車即可。

designer

或(一般用第一個)

qt5-tools desginer

參考資料

ImportError: DLL load failed while importing QtCore: The specified module could not be found.
DLL load failed when importing PyQt5
Is Qt Designer bundled with Anaconda?


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM