使用scikit-image模块时遇DLL加载失败错误求助
Hey there, let's get this DLL load issue sorted out for you. The error trace points directly to a problem with the PIL (Pillow) library's _imaging module failing to load—this is super common with older Python versions like 3.6.4 where package compatibility can get tricky. Here are step-by-step fixes to try:
1. Reinstall a Pillow Version Compatible with Python 3.6.4
Older Python versions need matching older Pillow releases. Let's swap out your current Pillow for one that plays nice:
- First, open your Anaconda Prompt, activate your working environment (if you're not using base), then uninstall the current Pillow:
conda uninstall pillow -y - Install a verified compatible version (Pillow 5.4.1 works great with Python 3.6 on Windows):
If conda gives you trouble with this version, try using pip instead:conda install pillow=5.4.1 -ypip install pillow==5.4.1
2. Ensure Your Environment Has numpy-mkl (Not Regular numpy)
You mentioned trying numpy-mkl, but let's double-check it's properly set up:
- List your current numpy package to confirm:
conda list numpy - If you see just
numpy(notnumpy-mkl), uninstall the regular version and install mkl-enabled numpy:conda uninstall numpy -y conda install numpy-mkl -y
3. Install the Correct Visual C++ Redistributable
Python 3.6 is compiled with Visual Studio 2015, so you need the matching redistributable package (even if you installed newer VC libraries):
- Make sure you have the 64-bit Visual C++ Redistributable for Visual Studio 2015 installed—this is required for the DLLs used by Pillow and scikit-image to load correctly. If you previously installed newer versions (like 2017/2019), this older version is still needed alongside them.
4. Test the Fix with a Minimal Code Snippet
After making the above changes, test if PIL loads first (since that's the root issue):
Open Spyder and run this minimal code:
from PIL import Image # Try opening your image to verify PIL works test_img = Image.open('mire.jpg') test_img.show() # Now test scikit-image from skimage import io img = io.imread('mire.jpg', as_grey=True) io.imshow(img)
If PIL loads and shows the image, scikit-image should work without the DLL error.
5. Create a Clean Environment (If All Else Fails)
If your current environment has conflicting packages, a fresh environment often fixes things:
- Create a new environment with Python 3.6.4:
conda create -n skimage_test python=3.6.4 -y - Activate it and install the required packages:
conda activate skimage_test conda install scikit-image numpy-mkl pillow=5.4.1 -y - Switch Spyder to use this new environment (go to
Tools > Preferences > Python interpreterand selectskimage_test), then run your code again.
内容的提问来源于stack exchange,提问作者nizar aoufi

