PyQt5-5.8.2 doesn't function on Windows 10

2019-09-14 18:43发布

I need to install qscintilla. I use pip for that:

> pip install qscintilla

PyQt5 automatically upgrades to the latest version '5.8.2', and sip upgrades to '4.19.2'. I suppose this has to do with the needs of qscintilla. Perhaps the latest version of qscintilla needs the latest PyQt version to operate properly.
Unfortunately, PyQt5-5.8.2 combined with sip-4.19.2 don't work on Windows 10. I get the following error:

> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.

I have checked my PATH variable in Windows 10, and I found the following directory: C:\Anaconda3\Library\bin. I've checked that folder, and the dll's are all present: Qt5Widgets.dll, 'Qt5Gui.dll`, ... So I can hardly believe that Python cannot find them.

I will now go through the things I've tried so far.  
 

1. Clean install of Anaconda => upgrade PyQt5.

I've removed Python completely from my PC, and installed Anaconda from scratch: Python 3.6 for Windows 64-bit.
Anaconda is shipped with an older version of PyQt5. I check the version like this:

> python
>>> from PyQt5.QtCore import QT_VERSION_STR
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> from sip import SIP_VERSION_STR
>>>
>>> QT_VERSION_STR
>>> '5.6.2'
>>> PYQT_VERSION_STR
>>> '5.6'
>>> SIP_VERSION_STR
>>> '4.18'

I simply upgrade my PyQt version, because I know that the qscintilla installation would do that anyway. If the problem is present after upgrading PyQt (and before installing qscintilla), I can rule out possible problems caused by the qscintilla installation. So here we go:

> pip install pyqt5 --upgrade
Collecting pyqt5
...
Successfully installed pyqt5-5.8.2 sip-4.19.2

As I expected, the upgraded version of pyqt results in the error:

> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.

 

2. Install PyQt5-5.7.1 instead of PyQt5-5.8.2.

I've found a wheel file from PyQt5-5.7.1 on this page: https://pypi.python.org/pypi/PyQt5/5.7.1
I hope that qscintilla will work on this one too. After all, it is a quite recent version. But first, I want to find out if I get it installed properly, and if the error above has gone.

> pip uninstall PyQt5
> pip uninstall sip
>
> pip install C:\..\Downloads\PyQt5-5.7.1-5.7.1-cp34.cp35.cp36-none-win_amd64.whl --no-cache-dir
...
Successfully installed pyqt5-5.7.1 sip-4.19.2

Unfortunately, the error persists.

 

3. Answers from StackOverflow.

I've checked several posts on StackOverflow, but none of them helped me out.

Can anyone help me? Perhaps you have successfully built the latest PyQt5-5.8.2 version from source code into a wheel file? I would be so happy if you share that file.

3条回答
2楼-- · 2019-09-14 19:17

It does work on windows 10. Your application failed to access specified DLL. A restart is required to get it working. I went through all the answers in the SO forums and it turns out a computer restart can set everything straight. so restart your pc.

查看更多
迷人小祖宗
3楼-- · 2019-09-14 19:21

I found a workaround: don't use Anaconda. I deleted Anaconda from my PC and did a fresh install like this:  
 

1. Install Python 64-bit

Download the 64-bit installer for Windows from this URL: https://www.python.org/downloads/release/python-361/

Make sure to include pip when asked for the installation options!  
 

2. Install PyQt5

Install PyQt5 by typing the following in your Windows command terminal:

> pip install PyQt5 --no-cache-dir
...
Successfully installed PyQt5-5.8.2 sip-4.19.2

The --no-cache-dir option makes sure that pip will not use an old version stored somewhere on your computer, but download the latest one instead.  
 

3. Install QScintilla

Install QScintilla like this:

> pip install qscintilla --no-cache-dir
Successfully installed qscintilla-2.10
查看更多
兄弟一词,经得起流年.
4楼-- · 2019-09-14 19:29

The root issue for me was different versions of PyQt wheel (5.9) and pyqt windows distro (5.6 - the last precompiled version available).

I found matching 5.6 wheel, but it only supported Python 3.5. So, I downgraded Python to 3.5 and installed PyQt5-5.6-cp35-none-win_amd64.whl

pip install pyqt5==5.6 

works equally well.

查看更多
登录 后发表回答