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

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

问题描述

我已在Windows 10笔记本电脑上安装了python 3.7,因为它已于今天(2018年6月28日)正式发布.然后我尝试使用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 "numpy\core\setup.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 files\python37\python.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('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\pcheg\AppData\Local\Temp\pip-record-uhj8233f\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\pcheg\AppData\Local\Temp\pip-install-7wjkw5wn\numpy\

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

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 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 on his website, then use pip install to install the package you want.

首先要做:

pip install pipwin

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

When that's installed, you can then do:

pipwin install 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.

执行此操作不需要您自己构建NumPy或安装所需的编译器,而无需通过PyPI安装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上的python 3.7上使用pip安装numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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