Python 3.6.3环境报错:无法找到mkl_core.dll入口点mkl_aa_fw_get_workdivision
Hey there, let's work through this frustrating MKL DLL error you're hitting while running your linear regression code in Python 3.6.3 for the Machine Learning A-Z course. This issue usually boils down to compatibility problems between your old Python version and newer MKL libraries, or corrupted DLL files. Here are some tried-and-true fixes to get your kernel running again:
1. Install a MKL version compatible with Python 3.6.3
Python 3.6 is pretty old (it's no longer supported), so newer MKL releases often break compatibility. Stick to a version that's known to work with 3.6:
- If you're using Conda, run this in your terminal:
conda install mkl=2018.0.3 mkl-service=1.1.2 - If you're using pip, use:
pip install mkl==2018.0.3 mkl-service==1.1.2
2. Repair corrupted MKL DLL files
Sometimes the issue is just a damaged DLL. Let's clean and reinstall:
- First, uninstall existing MKL components:
# For Conda users conda uninstall mkl mkl-service -y # For pip users pip uninstall mkl mkl-service -y - Navigate to your Python installation's
Lib/site-packages/numpy/corefolder and delete any MKL-related DLLs (likemkl_core.dll). - Reinstall the compatible MKL version from step 1.
3. Switch to OpenBLAS instead of MKL
If MKL keeps giving you grief, OpenBLAS is a reliable open-source alternative that plays nicely with older Python versions:
- Use Conda to install your libraries with OpenBLAS:
The conda-forge channel will automatically use OpenBLAS instead of MKL for these packages.conda create -n ml_openblas python=3.6.3 conda activate ml_openblas conda install numpy scipy scikit-learn pandas matplotlib -c conda-forge
4. Fix Spyder's kernel mismatch
Sometimes the problem is with Spyder, not your Python environment:
- Try running your linear regression script directly in the terminal (not Spyder) to see if it works. If it does, reset Spyder to fix the kernel issue:
spyder --reset - Restart Spyder and reselect your Python environment in the kernel settings.
5. Consider upgrading Python (if possible)
Python 3.6 reached end-of-life in 2021, so you'll keep running into compatibility issues with modern libraries. If your course materials don't strictly require 3.6, upgrade to a supported version like 3.8 or 3.9:
- Create a new Conda environment:
conda create -n ml_upgraded python=3.8 scikit-learn pandas numpy matplotlib spyder conda activate ml_upgraded - This fresh environment will have all compatible library versions out of the box, and you won't have to fight MKL errors anymore.
内容的提问来源于stack exchange,提问作者Guto Alvim

