在安装 Python 3.4 的同时为 Python 2.7 安装 numpy? [英] Installing numpy for Python 2.7 while also having Python 3.4 installed?

查看:62
本文介绍了在安装 Python 3.4 的同时为 Python 2.7 安装 numpy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我同时拥有 Python 2.7 和 Python 3.4(并且必须同时拥有,因为对于我正在运行的课程,学生可以选择使用其中之一).一位学生在他们的项目中使用了 Python 2.7 和 numpy,但是当我尝试安装 numpy 时,它会将其安装到 3.4.我需要将其安装到 2.7.

I have both Python 2.7 and Python 3.4 (and have to have both because for the class I'm running, students have the option of using either). One student has used Python 2.7 and numpy for their project, but when I attempt to install numpy, it installs it to 3.4. I need to install it to 2.7.

我正在使用这个站点的 numpy 1.9,我听说它也是 2.7 特定的:http://sourceforge.net/projects/numpy/files/NumPy/

I'm using numpy 1.9 from this site, which I'm told is also 2.7-specific: http://sourceforge.net/projects/numpy/files/NumPy/

但是,它仍然会转到 3.4 文件夹.显然,将其复制到 Python 2.7 不起作用.

However, nonetheless it still goes to the 3.4 folder. Copying it to Python 2.7 didn't work, obviously.

我该怎么做?

推荐答案

我建议使用 pip 安装.

I recommend installing with pip.

pip install numpy

如果这在 Windows 上不起作用,则从 http://www 下载二进制文件.lfd.uci.edu/~gohlke/pythonlibs/ 并在安装前将其转换为轮子.

If this doesn't work on windows then download the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and convert it to a wheel before installing.

pip install wheel
wheel convert path/to/binary
pip install numpy_wheel 

推荐使用Pip,因为您可以卸载.

Pip is recommended because you can uninstall.

检查安装位置

pip -V

您的环境变量路径可能指向错误的 pip.

You may have an environmental variable path to the wrong pip.

这篇关于在安装 Python 3.4 的同时为 Python 2.7 安装 numpy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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