Numpy向后兼容性:找不到Visual C ++ 9 [英] Numpy backwards compatibility: Visual C++ 9 not found

查看:88
本文介绍了Numpy向后兼容性:找不到Visual C ++ 9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从sourceforge下载了numpy-1.10.1,并且拥有Python 2.7.我提取,重命名并在site-packages下进入numpy目录.我跑了

I downloaded numpy-1.10.1 from sourceforge and I have Python 2.7. I extracted, renamed and entered the numpy directory under site-packages. I ran the

python setup.py install

命令,并得到此错误消息.我有Microsoft Visual C ++ 2013 Redistributable,并且要求版本9.

command, and got this error message. I have Microsoft Visual C++ 2013 Redistributable, and it's asking for version 9.

C:\Python27\Lib\site-packages\numpy
$ python setup.py install

[lots of text]
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat) Get it from http://aka.ms/vcpython27

为什么它不向后兼容?

推荐答案

Python 2.7使用Visual Studio 9,该版本于2008年问世.在构建Python扩展时,您必须使用相同的扩展名.编译程序包的编译器.因此,不幸的是,如果您想自己构建它,则必须下载它.您可能可以使用适用于Python 2.7的Microsoft Visual C ++编译器,但我尚未用numpy对其进行测试.

Python 2.7 uses Visual Studio 9, which came out in 2008. When you're building Python extensions, you must use the same compiler that the package was built with. So unfortunately, you'll have to download it if you want to build it yourself. You may be able to use the Microsoft Visual C++ Compiler for Python 2.7, but I haven't tested it with numpy.

另一方面,如果您不想下载新的编译器(您甚至无法通过Microsoft的网站找到 Visual Studio 9),则可以下载预制的轮子来自 Christoph Gohlke的网站.如果您没有充分的理由自己构建它,我建议您这样做.您可以先下载numpy wheel,然后再下载pip install "C:\path\to\numpy‑1.9.3+mkl‑cp27‑none‑win_amd64.whl".

On the other hand, if you don't want to download a new compiler (You can't even find Visual Studio 9 via Microsoft's website anymore), you can download a pre-built wheel from Christoph Gohlke's website. If you don't have a good reason to build it yourself, I recommend doing that. You can download the numpy wheel, and then pip install "C:\path\to\numpy‑1.9.3+mkl‑cp27‑none‑win_amd64.whl".

有一些方法可以在某个地方使用某些版本的MinGW来构建扩展,但是我不确定该怎么做. Christoph Gohlke的扩展程序可以很好地工作,我建议只下载它们.

There are ways to build the extensions with some version of MinGW somewhere, but I'm not sure how to do it. Christoph Gohlke's extensions work nicely though, and I would recommend just downloading those.

这篇关于Numpy向后兼容性:找不到Visual C ++ 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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