pip 无法安装 Scipy(或任何东西)(Python 3.10)

pip unable to install Scipy (or anything) (Python 3.10)

我一直在尝试下载一个名为 simpful 的库。但我刚刚开始 python,我想我缺少一些非常基本的东西。我在网上搜索某种解决方案很长时间了,但对我来说还没有任何效果。我还没有用 pip 下载任何东西 before.pip 版本是 21.3 和 python 3.10。我知道它的公正和错误日志,但也许有人能认出它。

Microsoft Windows [Version 10.0.19043.1288]


C:\Users\Lenovo>pip install simpful
Collecting simpful
  Using cached simpful-2.5.0-py3-none-any.whl (28 kB)
Collecting scipy>=1.0.0
  Using cached scipy-1.6.1.tar.gz (27.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing wheel metadata (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Lenovo\AppData\Local\Temp\tmpgaetr_j4'
       cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-install-udpf3ke6\scipy_89c5aff8add94fd794edf96a85737447
  Complete output (138 lines):
  setup.py:461: UserWarning: Unrecognized setuptools command ('dist_info --egg-base C:\Users\Lenovo\AppData\Local\Temp\pip-modern-metadata-y1pindem'), proceeding with generating Cython sources and expanding templates
    warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
  Running from SciPy source directory.
  lapack_opt_info:
  lapack_mkl_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries mkl_rt not found in ['C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib', 'C:\', 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs']
    NOT AVAILABLE

  openblas_lapack_info:
    libraries openblas not found in ['C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib', 'C:\', 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs']
  get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
  customize GnuFCompiler
  Could not locate executable g77
  Could not locate executable f77
  customize IntelVisualFCompiler
  Could not locate executable ifort
  Could not locate executable ifl
  customize AbsoftFCompiler
  Could not locate executable f90
  customize CompaqVisualFCompiler
  Could not locate executable DF
  customize IntelItaniumVisualFCompiler
  Could not locate executable efl
  customize Gnu95FCompiler
  Could not locate executable gfortran
  Could not locate executable f95
  customize G95FCompiler
  Could not locate executable g95
  customize IntelEM64VisualFCompiler
  customize IntelEM64TFCompiler
  Could not locate executable efort
  Could not locate executable efc
  customize PGroupFlangCompiler
  Could not locate executable flang
  don't know how to compile Fortran code on platform 'nt'
    NOT AVAILABLE

  openblas_clapack_info:
    libraries openblas,lapack not found in ['C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib', 'C:\', 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs']
    NOT AVAILABLE

  flame_info:
    libraries flame not found in ['C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib', 'C:\', 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs']
    NOT AVAILABLE

  accelerate_info:
    NOT AVAILABLE

  atlas_3_10_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries tatlas,tatlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries tatlas,tatlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
    libraries tatlas,tatlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
    NOT AVAILABLE

  atlas_3_10_info:
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries satlas,satlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries satlas,satlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
    libraries satlas,satlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_3_10_info'>
    NOT AVAILABLE

  atlas_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries ptf77blas,ptcblas,atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries ptf77blas,ptcblas,atlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
    libraries ptf77blas,ptcblas,atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_threads_info'>
    NOT AVAILABLE

  atlas_info:
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries f77blas,cblas,atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries f77blas,cblas,atlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
    libraries f77blas,cblas,atlas not found in C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_info'>
    NOT AVAILABLE

  lapack_info:
    libraries lapack not found in ['C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib', 'C:\', 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\libs']
    NOT AVAILABLE

  C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\numpy\distutils\system_info.py:1858: UserWarning:
      Lapack (http://www.netlib.org/lapack/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [lapack]) or by setting
      the LAPACK environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
  lapack_src_info:
    NOT AVAILABLE

  C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\numpy\distutils\system_info.py:1858: UserWarning:
      Lapack (http://www.netlib.org/lapack/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [lapack_src]) or by setting
      the LAPACK_SRC environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
    NOT AVAILABLE

  Traceback (most recent call last):
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 349, in <module>
      main()
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 331, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 151, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 588, in <module>
      setup_package()
    File "setup.py", line 584, in setup_package
      setup(**metadata)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-_fxq5igz\overlay\Lib\site-packages\numpy\distutils\core.py", line 135, in setup
      config = configuration()
    File "setup.py", line 499, in configuration
      raise NotFoundError(msg)
  numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found.
  To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
  See site.cfg.example in the Scipy source directory and
  https://docs.scipy.org/doc/scipy/reference/building/index.html for details.
 

      C:\Users\Lenovo\AppData\Local\Temp\pip-install-cuph39om\numpy_d591327a7abd4dfeb71a6882dfc84871\numpy\distutils\system_info.py:1712: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        if getattr(self, '_calc_info_{}'.format(lapack))():
        NOT AVAILABLE

      C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      running install
      running build
      running config_cc
      unifing config_cc, config, build_clib, build_ext, build commands --compiler options
      running config_fc
      unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
      running build_src
      build_src
      building py_modules sources
      building library "npymath" sources
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Lenovo\AppData\Local\Temp\pip-install-cuph39om\numpy_d591327a7abd4dfeb71a6882dfc84871\setup.py'"'"'; __file__='"'"'C:\Users\Lenovo\AppData\Local\Temp\pip-install-cuph39om\numpy_d591327a7abd4dfeb71a6882dfc84871\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Lenovo\AppData\Local\Temp\pip-record-pwa31lhc\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-m843rygd\overlay' --compile --install-headers 'C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-m843rygd\overlay\Include\numpy' Check the logs for full command output.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/04/ab/e2eb3e3f90b9363040a3d885ccc5c79fe20c5b8a3caa8fe3bf47ff653260/scipy-1.4.1.tar.gz#sha256=dee1bbf3a6c8f73b6b218cb28eed8dd13347ea2f87d572ce19b289d6fd3fbc59 (from https://pypi.org/simple/scipy/) (requires-python:>=3.5). Command errored out with exit status 1: 'C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Lenovo\AppData\Local\Temp\pip-standalone-pip-87jfigw1\__env_pip__.zip\pip' install --ignore-installed --no-user --prefix 'C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-m843rygd\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools 'Cython>=0.29.13' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'pybind11>=2.4.0' Check the logs for full command output.
  Using cached scipy-1.4.0.tar.gz (24.6 MB)

一直到栈底错误:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

所以你需要安装Microsoft VS C++ build tools

link下载:https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

建议创建一个隔离的虚拟环境,

c:\MY_PROJECT_FOLDER> py -m venv venv
c:\MY_PROJECT_FOLDER> venv\Scripts\activate
(venv) c:\MY_PROJECT_FOLDER> pip list
(venv) c:\MY_PROJECT_FOLDER> pip install simpful

非常基本,但显然是由于 Python 安装了两次造成的。

正在安装Scipy

SciPy 是一个免费的开源 Python 库,其中包含针对科学和技术计算优化和开发的软件包。如果你安装了 Python,你可以使用 Python 的标准 pip 包管理器,并从 Python 包索引安装它。在某些 Linux 发行版中,您可以使用系统的本机包管理器执行系统范围的安装。

第 1 步:确保检查您正在使用的 Python 版本

python -V

第二步:确保pip正常工作并且在python安装过程中安装(Python 2.7以上版本自带pip安装)

where pip

第三步:检查安装的pip是否更新

python -m pip install -U pip

第 4 步:检查是否安装了 numpy,因为 Scipy 有一个 numpy 依赖项。如果不安装 numpy

pip install numpy

第五步:安装scipy

pip install scipy