我应该如何使用pip安装软件包?

时间:2019-10-23 18:50:20

标签: python pip anaconda

我在计算机Windows10上安装了python anaconda并在其中创建了新环境。然后,我尝试在cmd中安装pip包“ scikit-learn”,但返回了以下错误。为什么我不能安装,该怎么办?


C:\Users\nima>pip install scikit-learn==0.19.1
Collecting scikit-learn==0.19.1
  Using cached https://files.pythonhosted.org/packages/f5/2c/5edf2488897cad4fb8c4ace86369833552615bf264460ae4ef6e1f258982/scikit-learn-0.19.1.tar.gz
Building wheels for collected packages: scikit-learn
  Building wheel for scikit-learn (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\nima\Anaconda3\envs\aidemy\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nima\\AppData\\Local\\Temp\\pip-install-jijyje_y\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\nima\\AppData\\Local\\Temp\\pip-install-jijyje_y\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\nima\AppData\Local\Temp\pip-wheel-3o9s77c6' --python-tag cp37
       cwd: C:\Users\nima\AppData\Local\Temp\pip-install-jijyje_y\scikit-learn\
  Complete output (735 lines):
  Partial import of sklearn during the build process.
  blas_opt_info:
  blas_mkl_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries mkl_rt not found in ['C:/Users/nima/Anaconda3/envs/aidemy\\Library\\lib']
    NOT AVAILABLE

  blis_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries blis not found in ['C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\lib', 'C:\\', 'C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\libs', 'C:\\Users\\nima\\Anaconda3\\Library\\lib']
    NOT AVAILABLE

  openblas_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries openblas not found in ['C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\lib', 'C:\\', 'C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\libs', 'C:\\Users\\nima\\Anaconda3\\Library\\lib']
  get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
  customize GnuFCompiler
  Could not locate executable g77

  ...

  customize PGroupFlangCompiler
  Could not locate executable flang
  don't know how to compile Fortran code on platform 'nt'
    NOT AVAILABLE

  atlas_3_10_blas_threads_info:
  Setting PTATLAS=ATLAS
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries tatlas not found in ['C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\lib', 'C:\\', 'C:\\Users\\nima\\Anaconda3\\envs\\aidemy\\libs', 'C:\\Users\\nima\\Anaconda3\\Library\\lib']
    NOT AVAILABLE


...

1 个答案:

答案 0 :(得分:0)

如果您安装了Anaconda,则安装软件包的最佳方法是将其与anaconda一起安装。为此,请像您一样转到命令行并尝试

conda install -c anaconda scikit-learn

它也是here,您可以使用此站点查找其他anaconda软件包的特定安装说明。希望这会有所帮助!