python 3.10 pip install libraries



我使用的是最新的python(仍然是演示,但却是发布前的最后一个版本)——3.10.0rc2。

我在安装numpy等标准库时遇到问题。我使用pip install,python -m pip

cmd输出:

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:usersmateuappdatalocalprogramspythonpython310python.exe' 'c:usersmateuappdatalocalprogramspythonpython310libsite-packagespip_vendorpep517in_process_in_process.py' build_wheel 'C:UsersmateuAppDataLocalTemptmpg9tjgygv'
cwd: C:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848toolscythonize.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/randombit_generator.pyx
Processing numpy/randommtrand.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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848numpydistutilssystem_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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848numpydistutilssystem_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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848numpydistutilssystem_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:usersmateuappdatalocalprogramspythonpython310lib
libraries tatlas,tatlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries lapack_atlas not found in C:
libraries tatlas,tatlas not found in C:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
libraries tatlas,tatlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries satlas,satlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries lapack_atlas not found in C:
libraries satlas,satlas not found in C:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
libraries satlas,satlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries ptf77blas,ptcblas,atlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries lapack_atlas not found in C:
libraries ptf77blas,ptcblas,atlas not found in C:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
libraries ptf77blas,ptcblas,atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries f77blas,cblas,atlas not found in c:usersmateuappdatalocalprogramspythonpython310lib
libraries lapack_atlas not found in C:
libraries f77blas,cblas,atlas not found in C:
libraries lapack_atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
libraries f77blas,cblas,atlas not found in c:usersmateuappdatalocalprogramspythonpython310libs
<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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848numpydistutilssystem_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:UsersmateuAppDataLocalTemppip-install-c3kg6xo0numpy_a0f8cbcefbea46f59d0a8ef8b828b848numpydistutilssystem_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:usersmateuappdatalocalprogramspythonpython310libdistutilsdist.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 buildsrc.win-amd64-3.10
creating buildsrc.win-amd64-3.10numpy
creating buildsrc.win-amd64-3.10numpydistutils
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

你知道库不能被安装是正常行为吗?有什么变通办法吗?

实际情况是,一些需要编译的库(如numpy)在安装程序(wheel)文件中包含了预编译的二进制文件。但是它们不包含非稳定版本(或小众架构)的二进制文件——相反,相同的文件包含在客户端(安装库的计算机)上构建二进制文件所需的源代码和一些资源。

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

如果 numpy已经在3.10上工作,那么你最好寻找一个非官方的构建轮,其中包含预编译的Python 3.10包,情况可能并非如此:虽然对于大多数最终用户代码来说,从Python 3.9到3.10不需要更改,但像numpy这样的项目严重依赖于语言的内部细节。

为各种Python包保留预编译二进制文件的镜像之一似乎有一个numpy用于windows上的Python 3.10: https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy(请注意,虽然看起来不错,但没有机制来验证这些包没有从源代码中掺杂,就像所有二进制安装一样(从官方来源安装的二进制文件通常会有哈希或其他验证机制+证书链到域名/品牌名称),所以,虽然我个人会使用来自lfd.uci.edu的包,但这不是没有风险的)

最新更新