简体   繁体   中英

QtCore Module not found using PySide2 on Anaconda

With a python file containing the two lines

import PySide2
from PySide2 import QtCore

The execution from Anaconda Prompt on Windows 10 looks as follows

(base) c:\src\pyside2>python ps2-first.py
Traceback (most recent call last):
  File "ps2-first.py", line 2, in <module>
    from PySide2 import QtCore
ImportError: DLL load failed: The specified module could not be found.

So the first import executed correctly, but it couldn't find the QtCore module.

Background:

Installed PySide2 using

(base) c:\src\pyside2>conda config --add channels conda-forge
(base) c:\src\pyside2>conda install pyside2

Which succeeded. Also, versions of conda and python are shown here:

(base) c:\src\pyside2>conda --version
conda 4.7.10

(base) c:\src\pyside2>python -V
Python 3.7.1

Checking for PySide 2 installation:

(base) c:\src\pyside2>conda list pyside2
# Name                    Version                   Build  Channel
pyside2                   5.9.0a1          py37h0555040_0    conda-forge

This DLL is in the path: pyside2.cp37-win_amd64.dll

The problem can be that your project folder name is pyside2 and Windows is case insensitive. So it is possible that python interpreter try to search QtCore inside your project folder.

If this not help please run python -v -c "from PySide2 import QtCore" and add log to your question.

The other problem can be that some dependencies of pyside2.cp37-win_amd64.dll can be missed. then loading of this library also will fail. You can check dependencies of dll by dependencywalker .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM