首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python3.10 pip安装库

Python3.10 pip安装库
EN

Stack Overflow用户
提问于 2021-09-09 12:59:43
回答 1查看 2K关注 0票数 0

我正在使用最新版本(仍然是演示版,但发布之前的最后一个版本) python --即3.10.0rc2。

我在安装标准库(如numpy )方面有问题。我正在使用pip installpython -m pip等。

cmd产出:

代码语言:javascript
复制
Collecting numpy
  Using cached numpy-1.21.2.zip (10.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\mateu\appdata\local\programs\python\python310\python.exe' 'c:\users\mateu\appdata\local\programs\python\python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\mateu\AppData\Local\Temp\tmpg9tjgygv'
       cwd: C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848
  Complete output (208 lines):
  setup.py:63: RuntimeWarning: NumPy 1.21.2 may not yet support Python 3.10.
    warnings.warn(
  Running from numpy source directory.
  C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\tools\cythonize.py:69: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
    from distutils.version import LooseVersion
  Processing numpy/random\_bounded_integers.pxd.in
  Processing numpy/random\bit_generator.pyx
  Processing numpy/random\mtrand.pyx
  Processing numpy/random\_bounded_integers.pyx.in
  Processing numpy/random\_common.pyx
  Processing numpy/random\_generator.pyx
  Processing numpy/random\_mt19937.pyx
  Processing numpy/random\_pcg64.pyx
  Processing numpy/random\_philox.pyx
  Processing numpy/random\_sfc64.pyx
  Cythonizing sources
  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\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  blis_info:
    libraries blis not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  openblas_info:
    libraries openblas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\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

  accelerate_info:
    NOT AVAILABLE

  atlas_3_10_blas_threads_info:
  Setting PTATLAS=ATLAS
    libraries tatlas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  atlas_3_10_blas_info:
    libraries satlas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  atlas_blas_threads_info:
  Setting PTATLAS=ATLAS
    libraries ptf77blas,ptcblas,atlas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  atlas_blas_info:
    libraries f77blas,cblas,atlas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\numpy\distutils\system_info.py:2026: UserWarning:
      Optimized (vendor) Blas libraries are not found.
      Falls back to netlib Blas library which has worse performance.
      A better performance should be easily gained by switching
      Blas library.
    if self._calc_info(blas):
  blas_info:
    libraries blas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\numpy\distutils\system_info.py:2026: UserWarning:
      Blas (http://www.netlib.org/blas/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [blas]) or by setting
      the BLAS environment variable.
    if self._calc_info(blas):
  blas_src_info:
    NOT AVAILABLE

  C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\numpy\distutils\system_info.py:2026: UserWarning:
      Blas (http://www.netlib.org/blas/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [blas_src]) or by setting
      the BLAS_SRC environment variable.
    if self._calc_info(blas):
    NOT AVAILABLE

  non-existing path in 'numpy\\distutils': 'site.cfg'
  lapack_opt_info:
  lapack_mkl_info:
    libraries mkl_rt not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  openblas_lapack_info:
    libraries openblas not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  openblas_clapack_info:
    libraries openblas,lapack not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  flame_info:
    libraries flame not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  atlas_3_10_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in c:\users\mateu\appdata\local\programs\python\python310\lib
    libraries tatlas,tatlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\libs
    libraries tatlas,tatlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\lib
    libraries satlas,satlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\libs
    libraries satlas,satlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\lib
    libraries ptf77blas,ptcblas,atlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\libs
    libraries ptf77blas,ptcblas,atlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\lib
    libraries f77blas,cblas,atlas not found in c:\users\mateu\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\mateu\appdata\local\programs\python\python310\libs
    libraries f77blas,cblas,atlas not found in c:\users\mateu\appdata\local\programs\python\python310\libs
  <class 'numpy.distutils.system_info.atlas_info'>
    NOT AVAILABLE

  lapack_info:
    libraries lapack not found in ['c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\lib', 'C:\\', 'c:\\users\\mateu\\appdata\\local\\programs\\python\\python310\\libs']
    NOT AVAILABLE

  C:\Users\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\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\mateu\AppData\Local\Temp\pip-install-c3kg6xo0\numpy_a0f8cbcefbea46f59d0a8ef8b828b848\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

  numpy_linalg_lapack_lite:
    FOUND:
      language = c
      define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]

  Warning: attempted relative import with no known parent package
  c:\users\mateu\appdata\local\programs\python\python310\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
    warnings.warn(msg)
  running bdist_wheel
  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
  creating build
  creating build\src.win-amd64-3.10
  creating build\src.win-amd64-3.10\numpy
  creating build\src.win-amd64-3.10\numpy\distutils
  building library "npymath" sources
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
  ----------------------------------------
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly

您知道不能安装库是否是正常行为吗?有什么解决办法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-09 13:23:21

一些需要编译的库(如numpy )在安装程序(轮转)文件中包含了预编译的二进制文件。但它们不会包括用于非稳定版本(或小众架构)的二进制文件--相反,同一个文件拥有在客户端(安装库的计算机)构建二进制文件所需的源代码和一些资源。

错误指示:不包括二进制文件,并且在计算机上生成二进制文件失败,可能是缺乏构建环境。在Linux下,安装构建numpy (和其他库)所需的一切或多或少都很简单。在Windows计算机上设置这样的环境可能有些复杂。

如果numpy已经在使用3.10 (这可能不是这样的话),那么您应该更好地寻找一个非正式的构建轮,该包是为Python 3.10预编译的--虽然对于大多数最终用户代码来说,不需要从Python 3.9更改为3.10,但像numpy这样的项目在很大程度上依赖于语言的内部细节。

为各种Python包保留预编译二进制文件的镜像之一,在windows上似乎有numpy for python3.10:https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy (请注意,尽管看上去还不错,但没有机制来验证这些包是否与源代码混淆,与所有二进制安装程序(官方来源的二进制安装通常会有散列或其他验证机制+域/品牌名称的证书链)相同,所以,虽然我个人会使用来自lfd.uci.edu的包,但这并不是没有风险的)。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69118677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档