如何在windows中成功安装numpy

2024-05-10 05:30:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着从我的终端安装numpy,它给了我复杂的错误信息。请有人帮帮我,我对Python和Python很陌生

正在执行pip3 install numpy command

C:\Users\Benedict\PycharmProjects\Example1>pip3 install numpy
Collecting numpy
  Using cached numpy-1.19.2.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\benedict\appdata\local\programs\python\python39\python.exe' 'c:\users\benedict\appdata\local\programs\python\python39\lib\site-packages\pip\_
vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Public\Documents\Wondershare\CreatorTemp\tmpct665suw'
         cwd: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy
    Complete output (200 lines):
    Running from numpy source directory.
    setup.py:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    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\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\
python\\python39\\libs']
      NOT AVAILABLE
    
    blis_info:
      libraries blis not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\py
thon\\python39\\libs']
      NOT AVAILABLE
    
    openblas_info:
      libraries openblas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs
\\python\\python39\\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
    
    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\
python\\python39\\libs']
      NOT AVAILABLE
    
    atlas_3_10_blas_info:
      libraries satlas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\
python\\python39\\libs']
      NOT AVAILABLE
    
    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\
local\\programs\\python\\python39\\libs']
      NOT AVAILABLE
    
    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\loca
l\\programs\\python\\python39\\libs']
      NOT AVAILABLE
    
    accelerate_info:
      NOT AVAILABLE
    
    C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy\numpy\distutils\system_info.py:1914: 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\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\py
thon\\python39\\libs']
      NOT AVAILABLE
    
    C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy\numpy\distutils\system_info.py:1914: 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\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy\numpy\distutils\system_info.py:1914: 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\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\
python\\python39\\libs']
      NOT AVAILABLE
    
    openblas_lapack_info:
      libraries openblas not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs
\\python\\python39\\libs']
      NOT AVAILABLE
    
    openblas_clapack_info:
      libraries openblas,lapack not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\p
rograms\\python\\python39\\libs']
      NOT AVAILABLE
    
    flame_info:
      libraries flame not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\p
ython\\python39\\libs']
      NOT AVAILABLE
    
    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries tatlas,tatlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries lapack_atlas not found in C:\
      libraries tatlas,tatlas not found in C:\
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
      libraries tatlas,tatlas not found in c:\users\benedict\appdata\local\programs\python\python39\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\benedict\appdata\local\programs\python\python39\lib
      libraries satlas,satlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries lapack_atlas not found in C:\
      libraries satlas,satlas not found in C:\
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
      libraries satlas,satlas not found in c:\users\benedict\appdata\local\programs\python\python39\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\benedict\appdata\local\programs\python\python39\lib
      libraries ptf77blas,ptcblas,atlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries lapack_atlas not found in C:\
      libraries ptf77blas,ptcblas,atlas not found in C:\
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
      libraries ptf77blas,ptcblas,atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE
    
    atlas_info:
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries f77blas,cblas,atlas not found in c:\users\benedict\appdata\local\programs\python\python39\lib
      libraries lapack_atlas not found in C:\
      libraries f77blas,cblas,atlas not found in C:\
      libraries lapack_atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
      libraries f77blas,cblas,atlas not found in c:\users\benedict\appdata\local\programs\python\python39\libs
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE
    
    lapack_info:
      libraries lapack not found in ['c:\\users\\benedict\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\benedict\\appdata\\local\\programs\\
python\\python39\\libs']
      NOT AVAILABLE
    
    C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy\numpy\distutils\system_info.py:1748: 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\Public\Documents\Wondershare\CreatorTemp\pip-install-d1sw4kmw\numpy\numpy\distutils\system_info.py:1748: 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_')]
    
    c:\users\benedict\appdata\local\programs\python\python39\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    running dist_info
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build\src.win-amd64-3.9
    creating build\src.win-amd64-3.9\numpy
    creating build\src.win-amd64-3.9\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: Command errored out with exit status 1: 'c:\users\benedict\appdata\local\programs\python\python39\python.exe' 'c:\users\benedict\appdata\local\programs\python
\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Public\Documents\Wondershare\CreatorTemp\tmpct665suw' Check
 the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the 'c:\users\benedict\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command.

Tags: ininfonumpylibrariesliblocalnotusers
2条回答

步骤1:检查Python版本 在安装NumPy之前,您需要知道您有哪个Python版本。这种编程语言预先安装在大多数操作系统上(Windows除外;您需要在Windows上手动安装Python)

最有可能的情况是,您安装了Python 2或Python 3,甚至是这两个版本

要检查是否有Python 2,请运行以下命令:

python -V

输出应该给您一个版本号

要查看系统上是否有Python 3,请在终端窗口中输入以下内容:

python3 -V

在下面的示例中,您可以看到两个版本的Python都存在。 enter image description here

步骤3:下载PIPget-pip.py

在安装PIP之前,请在pypa.io上下载get-PIP.py文件:get-PIP.py

将文件下载到Windows中所需的文件夹。您可以将文件保存到任何位置,但请记住路径,以便以后使用

步骤4:在Windows上安装PIP 如果命令提示符尚未打开,请打开它。使用cd命令,后跟文件夹名称,导航到get-pip.py文件的位置。这是您以前用作下载位置的文件夹

要在以下位置安装PIP类型:

python get-pip.py 应该启动PIP安装。如果找不到该文件,请仔细检查保存该文件的文件夹的路径

您可以使用以下命令查看当前目录的内容:

dir

dir命令返回目录内容的完整列表

步骤4:如何检查PIP版本 要检查PIP的当前版本,请键入以下命令:

pip  version

此命令返回平台的当前版本

步骤5:安装NumPy 通过Pip设置,您可以使用其命令行安装NumPy

使用Python 2安装NumPy,方法是键入:

pip install numpy

Pip下载NumPy软件包并通知您它已成功安装

相关问题 更多 >