You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10 32位Python3环境下PyQt5导入报错求助

Fixing PyQt5 ImportError: DLL Load Failed on 32-bit Python 3.6 (Windows 10)

Hey there, that DLL load error is super frustrating when you’ve got multiple Python versions to juggle. Let’s walk through some targeted fixes to get your PyQt5 script running:

Step 1: Double-Check Your Python Interpreter Bitness

First, confirm you’re actually using the 32-bit Python 3.6 instance you intended. Run this command in your terminal:

py -3.6-32 -c "import struct; print(struct.calcsize('P') * 8)"

You should see 32 printed. If not, there might be a misconfiguration in how your Python versions are registered.

Step 2: Fully Uninstall and Reinstall PyQt5 (With Cleanup)

Residual files from previous installs can cause conflicts. Let’s wipe existing PyQt5 and its dependencies first:

py -3.6-32 -m pip uninstall -y PyQt5 PyQt5-sip

Then reinstall with a clean cache to avoid pulling corrupted or mismatched files:

py -3.6-32 -m pip install PyQt5==5.15.4 --no-cache-dir

(Note: PyQt5 5.15.4 is the last version that officially supports Python 3.6. Newer versions dropped 3.6 support, which might be part of your issue.)

Step 3: Install the Correct 32-bit VC++ Redistributable

Python 3.6 relies on the 32-bit version of the Visual C++ Redistributable for Visual Studio 2015-2019. If you only have the 64-bit version installed, 32-bit DLLs won’t load properly. Make sure you download and install the x86 variant of this redistributable package.

Step 4: Add Qt’s DLL Directory to Your PATH

Sometimes Windows can’t find the Qt DLLs bundled with PyQt5. Add the Qt bin directory to your system PATH temporarily (or permanently via System Properties):

set PATH=C:\Python36-32\Lib\site-packages\PyQt5\Qt\bin;%PATH%

Then try running your script again with py -3.6-32 your_script.py.

Step 5: Manually Install the Matching PyQt5 Wheel

If pip is still pulling the wrong package, grab the exact wheel for your setup:

  1. Get the PyQt5-5.15.4-cp36-cp36m-win32.whl file (this is the 32-bit wheel built for Python 3.6)
  2. Install it directly using:
py -3.6-32 -m pip install C:\path\to\PyQt5-5.15.4-cp36-cp36m-win32.whl

Step 6: Eliminate Python 2 vs 3 Conflicts

Ensure you’re always explicitly calling the 32-bit Python 3.6 interpreter when running your script or installing packages. Avoid using plain python or pip commands, as they might default to your Python 2.7 installation if it’s higher in the PATH.


内容的提问来源于stack exchange,提问作者CodingCat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 07:37:29