开发者问题收集

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

2021-10-21
2581

我一直在尝试下载一个名为 simpful 的库。但我刚开始使用 python,我想我缺少了一些非常基本的东西。我在网上搜索了很长时间的解决方案,但对我来说没有任何效果。我之前没有用 pip 下载过任何东西。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)
3个回答

一直到堆栈最底部出现错误:

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++ 构建工具

下载链接: 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
cizario
2021-10-21

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

Romuloyloy
2021-12-27

安装 Scipy

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

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

python -V

步骤 2:确保 pip 运行正常且已在 python 安装期间安装(以上 Python 2.7 附带 pip 安装)

where pip

步骤 3:检查已安装的 pip 是否已更新

python -m pip install -U pip

步骤 4:检查是否已安装 numpy,因为 Scipy 有一个依赖项是 numpy。如果没有安装 numpy

pip install numpy

步骤 5:安装 scipy

pip install scipy
dataninsight
2021-12-27