如何修复“错误:命令出错,退出状态为 1"在 Python 3.8.0 中使用 pip 安装 numpy 时 [英] How to fix "ERROR: Command errored out with exit status 1" when using pip to install numpy in Python 3.8.0

查看:237
本文介绍了如何修复“错误:命令出错,退出状态为 1"在 Python 3.8.0 中使用 pip 安装 numpy 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 Python 升级到 3.8.0 后,我无法使用 pip 安装与 numpy 相关的软件包,包括 numpy、matplotlib 和 sklearn.错误信息如下:

After upgrading Python to 3.8.0, I have trouble installing packages related to numpy using pip, including numpy, matplotlib and sklearn. The error message is as follows:

我应该怎么做才能解决这个问题?

What should I do to solve this problem?

C:\WINDOWS\System32>pip install numpy

...

Installing collected packages: numpy
    Running setup.py install for numpy ... error
    ERROR: Command errored out with exit status 1:                                                                           command: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Tonakai\AppData\Local\Temp\pip-install-ub45_c1a\numpy\
    Complete output (299 lines):
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)

  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\\tonakai\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\tonakai\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE
...

c:\users\tonakai\appdata\local\programs\python\python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    non-existing path in 'numpy\\random': 'src\\splitmix64\\splitmix.h'
    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 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

推荐答案

您需要升级 setuptools 和 pip.你可以通过运行:

You need to upgrade setuptools and pip. You can do that by running:

pip install -U pip setuptools

然后你可以运行你的pip install numpy.

这篇关于如何修复“错误:命令出错,退出状态为 1"在 Python 3.8.0 中使用 pip 安装 numpy 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆