在 Windows 10 for python 3.7 上使用 pip 安装 numpy [英] Installing numpy with pip on windows 10 for python 3.7

查看:44
本文介绍了在 Windows 10 for python 3.7 上使用 pip 安装 numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从今天(2018 年 6 月 28 日)正式发布以来,我在我的 Windows 10 笔记本电脑上安装了 python 3.7.然后我尝试使用 pip

I installed python 3.7 on my Windows 10 laptop since it has been officially released as of today (06/28/2018). Then i tried to install numpy package using pip

pip install numpy

安装继续进行但最终失败并出现以下错误:

The install proceeds but finally fails with the below error :

        source = func(extension, build_dir)
      File "numpycoresetup.py", line 675, in get_mathlib_info
        raise RuntimeError("Broken toolchain: cannot link a simple C program")
    RuntimeError: Broken toolchain: cannot link a simple C program

    ----------------------------------------
Command ""c:program filespython37python.exe" -u -c "import setuptools, tokenize;__file__='C:\Users\pcheg\AppData\Local\Temp\pip-install-7wjkw5wn\numpy\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UserspchegAppDataLocalTemppip-record-uhj8233finstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UserspchegAppDataLocalTemppip-install-7wjkw5wn
umpy

有关如何克服此安装错误的任何想法?谢谢.

Any ideas as to how to overcome this install Error? Thanks.

推荐答案

如果您没有正确的构建设置,在 Windows 上安装 NumPy 是一个常见问题.相反,我总是去Christoph Gohlke 的网站下载您可以为自己安装的轮子计算机.Christoph 慷慨地使用合适的构建环境亲自构建了这些库,并将其发布在他的网站上.

Installing NumPy on Windows is a common problem if you don't have the right build setup. Instead, I always go to Christoph Gohlke's website to download the wheels you can install for your computer. Christoph generously builds the libraries himself with the right build environment and he posts it on his website.

首先,从 PyPI 安装 pipwin 这将安装一个实用程序就像 pip 一样,但它会从他的网站下载你感兴趣的实际包,然后使用 pipwin install 安装你想要的包.

First, install pipwin from PyPI which will install a utility that acts like pip but it will download the actual package you're interested in from his website, then use pipwin install to install the package you want.

先做:

pip install pipwin

安装后,您可以执行以下操作:

When that's installed, you can then do:

pipwin 安装 numpy

这将在您的系统上安装最新版本的 NumPy.这样您就不必专门搜索适用于您的特定 Python 版本的 NumPy 版本.

This will install the latest version of NumPy on your system. This way you don't have to specifically search for the version of NumPy that is for your specific version of Python.

转到 NumPy 部分:https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy 然后下载与您的 Python 版本(2 或 3 和 32 位或 64 位)兼容的 3.7 版本.例如,文件名 numpy‑1.14.5+mkl‑cp37‑cp37m‑win_amd64.whl 适用于 NumPy 1.14.5,Python 3.7 - 64 位.您可以在文件名中选择您需要哪个版本的 NumPy 以及哪个版本的 Python 解释器和位版本.

Go to the NumPy section: https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy then download the version for 3.7 that is compatible with your version of Python (2 or 3 and 32-bit or 64-bit). For example, the filename numpy‑1.14.5+mkl‑cp37‑cp37m‑win_amd64.whl is for NumPy 1.14.5, Python 3.7 - 64 bit. You can pick out which version of NumPy and which version of the Python interpreter and bit version you need in the filename.

与通过 PyPI 安装 NumPy 相比,这样做永远不需要您自己构建 NumPy 或安装所需的编译器.您只需下载轮子并自行安装即可.假设您已经下载了它,只需执行以下操作:

Doing this never requires you to build NumPy yourself or install the required compiler as opposed to installing NumPy through PyPI. You can just download the wheel and install it yourself. Assuming you've already downloaded it, just do:

pip install numpy‑1.14.5+mkl‑cp37‑cp37m‑win_amd64.whl

... 假设轮子在您当前所在的目录中.

... assuming the wheel is in the directory you're currently in.

这篇关于在 Windows 10 for python 3.7 上使用 pip 安装 numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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