安装scilit-learn后出现以下问题:
sklearn报错解决 ImportError: DLL load failed: 找不到指定的模块
通过无数的的安装卸载scikit-learn、numpy、scipy还是无法解决问题
pip uninstall scikit-learn
pip uninstall numpy
pip uninstall scipy
以下通过scikit-learn 源码编译安装:
pip3 install cython
安装sklearn:
pip3 install git+https://github.com/scikit-learn/scikit-learn
安装出现以下问题
copying sklearn\tests\test_kernel_ridge.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_metaestimators.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_multiclass.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_multioutput.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_naive_bayes.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_pipeline.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_random_projection.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\test_site_joblib.py -> build\lib.win-amd64-3.7\sklearn\tests
copying sklearn\tests\__init__.py -> build\lib.win-amd64-3.7\sklearn\tests
running build_clib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
Missing compiler_cxx fix for MSVCCompiler
customize MSVCCompiler using build_clib
building 'libsvm-skl' library
compiling C sources
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Command "d:\apps\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\WEILON~1.ZHA\\AppData\\Local\\Temp\\pip-req-build-41pat1r3\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\WEILON~1.ZHA\AppData\Local\Temp\pip-record-8hjugntu\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\WEILON~1.ZHA\AppData\Local\Temp\pip-req-build-41pat1r3\
出现以上问题,error: Microsoft Visual C++ 14.0 is required
https://964279924.ctfile.com/fs/1445568-239446865
https://support.microsoft.com/en-us/help/3151800/the-net-framework-4-6-2-offline-installer-for-windows
安装成功后import 出现以下问题:
>>> from sklearn.preprocessing import LabelEncoder, OneHotEnco
D:\apps\python37\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'OneHotEnco' from 'sklearn.preprocessing' (D:\apps\python37\lib\site-packages\sklearn\preprocessing\__init__.py)
然后将之前安装的scikit-learn、numpy、scipy 重新卸载了,按照numpy、scipy 、scikit-learn的顺序安装,问题解决!