安装sklearn时出错

时间:2017-04-04 16:28:18

标签: python-3.x scikit-learn

当我尝试运行时(在Windows 10上):

pip install sklearn

我得到了很长的

列表
copying sklearn\tests\test_pipeline.py -> build\lib.win-amd64-3.6\sklearn\tests
    copying sklearn\tests\test_random_projection.py -> build\lib.win-amd64-3.6\sklearn\tests
    copying sklearn\tests\__init__.py -> build\lib.win-amd64-3.6\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
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\sklearn
    creating build\temp.win-amd64-3.6\sklearn\svm
    creating build\temp.win-amd64-3.6\sklearn\svm\src
    creating build\temp.win-amd64-3.6\sklearn\svm\src\libsvm
    cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"c:\program files\python\lib\site-packages\numpy\core\include" /EHsc /Tpsklearn\svm\src\libsvm\libsvm_template.cpp /Fobuild\temp.win-amd64-3.6\sklearn\svm\src\libsvm\libsvm_template.obj
    Could not locate executable cl.exe
    Executable cl.exe does not exist

    error: Command "cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"c:\program files\python\lib\site-packages\numpy\core\include" /EHsc /Tpsklearn\svm\src\libsvm\libsvm_template.cpp /Fobuild\temp.win-amd64-3.6\sklearn\svm\src\libsvm\libsvm_template.obj" failed with exit status 1

    ----------------------------------------
Command ""c:\program files\python\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\$andu\\AppData\\Local\\Temp\\pip-build-cho6u5yy\\scikit-learn\\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\$andu\AppData\Local\Temp\pip-977em_sb-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\$andu\AppData\Local\Temp\pip-build-cho6u5yy\scikit-learn\

网上找到的任何建议都不适合我。

我该如何处理?

我安装了numpy-1.12.1+mkl-cp36-cp36m-win_amd64.whlscipy-0.19.0-cp36-cp36m-win_amd64.whl

2 个答案:

答案 0 :(得分:0)

我认为您需要在PATH中安装cl.exe。

cl.exe应位于您的(visual studio文件夹)\ VC \ bin

答案 1 :(得分:0)

试试这个:

  1. 转到放置方向盘文件的Windows资源管理器位置
  2. 点击地址栏并输入cmd
  3. 输入pip install <filename>.whl并按Enter