无法在 python 3.9 版中安装 numpy [英] Failed to install numpy in python version 3.9

查看:575
本文介绍了无法在 python 3.9 版中安装 numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Python 的初学者.当我想安装NumPy时,我没有工作,尤其是当执行到达准备车轮元数据"这一行时这是错误:

I'm a beginner in python. When I want to install NumPy, I didn't work, and especially when the execution reaches this line "Preparing wheel metadata" and here is the error:

C:\Users\dell>pip install numpy
Defaulting to user installation because normal site-packages is not writeable
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: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\dell\AppData\Local\Temp\tmphnzlje19' Check the logs for full command output.

推荐答案

这个 pip install 命令试图从源代码构建 numpy.您可以看到这一点,因为正在下载 .zip 文件而不是轮子 .whl 文件..zip 文件包含源代码.NumPy 的大部分内容是用 C 编写的,需要编译,但很可能是您的计算机没有安装编译器.轮子 (.whl) 文件不需要编译——它包含已编译的代码,因此您不需要编译器.

This pip install command is attempting to build numpy from source. You can see this because a .zip file is being downloaded instead of a wheel .whl file. The .zip file contains the source code. Much of NumPy is written in C and needs to be compiled, but it is likely the case that your computer does not have a compiler installed. A wheel (.whl) file does not need to be compiled -- it includes already compiled code, so you do not need a compiler.

编辑(2020 年 12 月 15 日):wheel 文件可用于 1.19.4 版,因此可以将 pip install numpy 与 python 3.9 一起使用.

EDIT (December 15, 2020): wheel files are available for version 1.19.4, so one can use pip install numpy with python 3.9.

根据https://pypi.org/project/numpy/#files,python 3.9 还没有轮文件,所以你的选择是从源代码构建 numpy,使用 python 3.8 直到 python 3.9 的 numpy 轮出现,或者使用 conda, 已经为 python 3.9 分发了 numpy.

According to https://pypi.org/project/numpy/#files, there is no wheel file yet for python 3.9, so your options are to build numpy from source, use python 3.8 until a numpy wheel comes out for python 3.9, or use conda, which already distributes numpy for python 3.9.

这篇关于无法在 python 3.9 版中安装 numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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