Python 安装 numpy 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20567418/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 20:44:17  来源:igfitidea点击:

Error installing numpy

pythonnumpy

提问by kartikeykant18

I'm trying to install numpy My steps are as follows: Open cmd in numpy extracted folder(where I had extracted .tar.gz file) Then python setup.py install But I'm getting an error as follows: enter image description herewith many warnings like this and at the end error unable to find vcvarsall.bat (I regret to put a photo but I couldn't find any better way to copy text from cmd window) if possible suggest a compiled setup of numpy

我正在尝试安装 numpy 我的步骤如下:在 numpy 提取的文件夹中打开 cmd(我在其中提取了 .tar.gz 文件)然后 python setup.py install 但我收到如下错误: 在此处输入图片说明有很多警告,如这和最后错误无法找到 vcvarsall.bat(我很遗憾放了一张照片,但我找不到任何更好的方法来从 cmd 窗口复制文本)如果可能的话建议一个编译的 numpy 设置

采纳答案by KobeJohn

Edit: Apparently this answer still gets attention occasionally. For anybody needing numpy, you almost certainly will be happier and more productive if you just go and get conda or minicondawhich make installing all kinds of libraries like numpy very easy. In fact the first example on the page is conda install numpy. An additional bonus: I find that conda works better as a package manager than virtualenv.

编辑:显然这个答案偶尔还是会受到关注。对于任何需要 numpy 的人来说,如果你只是去获取conda 或 miniconda这使得安装像 numpy 这样的各种库变得非常容易,你几乎肯定会更快乐、更有效率。事实上,页面上的第一个示例是conda install numpy. 额外的好处:我发现 conda 作为包管理器比 virtualenv 更有效。

Summary: Just use anaconda

总结:只需使用anaconda



There is a discussion on this on stackoverflow but I can't find it. It's easy once you know how to do it, but not obvious. The key is to use the premade binaries instead of compiling it yourself + easy_install. Unless you want to compile it yourself and that's a whole different answer.

在stackoverflow上有一个关于这个的讨论,但我找不到它。一旦你知道如何去做,这很容易,但并不明显。关键是使用预制的二进制文件而不是自己编译+easy_install。除非你想自己编译它,这是一个完全不同的答案。

Either installing to virtualenv or just to your main python, here is what I do:

安装到 virtualenv 或仅安装到您的主 python,这就是我所做的:

  1. Download the latest numpy installer for windows and your version of python here.

  2. Open that file in 7zip or whatever you have. Extract the installer that works for your CPU. Probably SSE3.

  3. Put that file somewhere and get the full path to it including the name of the file.

  4. From your command line with/without virtualenv activated, type: easy_install "..."with the quotes and with your full path pasted in place of ...

  5. (extra step) you may need to add C:\python27\Scripts\to your system path (using your actual python path) if you get an error that easy_install is not found.

  1. 此处下载适用于 Windows 的最新 numpy 安装程序和您的 Python 版本 。

  2. 以 7zip 或您拥有的任何格式打开该文件。提取适用于您的 CPU 的安装程序。可能是SSE3。

  3. 将该文件放在某处并获取它的完整路径,包括文件名。

  4. 在激活/未激活 virtualenv 的命令行中,键入: easy_install "..."使用引号和粘贴的完整路径代替 ...

  5. (额外的步骤)C:\python27\Scripts\如果您收到未找到 easy_install 的错误,您可能需要添加到您的系统路径(使用您的实际 python 路径)。

That should do it. If you want to compile it yourself (if the message you posted lost you, then you probably don't), then you'll need to read up on getting a c compiler installed and setup in windows for python.

应该这样做。如果你想自己编译它(如果你发布的消息让你失去了你,那么你可能没有),那么你需要阅读在 windows 中安装和设置 ac 编译器 for python。

回答by Games Brainiac

This is because numpy needs to compile binaries. You can get the binaries from here.

这是因为 numpy 需要编译二进制文件。您可以从这里获取二进制文件。

回答by erb

You should be able to use the installers available here without any issues: https://sourceforge.net/projects/numpy/files/NumPy/1.8.0/

您应该可以毫无问题地使用此处提供的安装程序:https: //sourceforge.net/projects/numpy/files/NumPy/1.8.0/

Make sure to pick the appropriate executable for your Python version.
If you are running Python 2.7 use the one linked here.

确保为您的 Python 版本选择合适的可执行文件。
如果您运行的是 Python 2.7,请使用此处链接的那个。

Note for future readers: If any updates to NumPy have been released, you might want to go hereand choose the latest version available.

给未来读者的注意事项:如果 NumPy 的任何更新已经发布,您可能想要去这里并选择可用的最新版本。

回答by Rausta

I had this same issue trying to install numpy 1.9.2 for python 3.4 (most recent version at 02/04/2015)

我在尝试为 python 3.4 安装 numpy 1.9.2 时遇到了同样的问题(最新版本为 02/04/2015)

I manged to fix this by downloading the .exe from http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python3.4.exe/download

我设法通过从http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python3.4.exe/download下载 .exe 来解决这个问题

and now I can use Numpy in pycharm

现在我可以在 pycharm 中使用 Numpy

Hope this helps!

希望这可以帮助!