从安装numpy [英] Installing numpy from

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

问题描述

(我在这里查看了许多答案,但未回答类似问题或未解决我的问题).

(I looked at many answers on here but similar questions were not answered or didn't address my question).

我在Mac-OSX 10.8.5上使用numpy + scipy + matplotlib.我的机器上有numpy 1.6.1,并在/System/Library/Frameworks/Python.framework/Versions/2.7/中使用python 2.7.5.我已经从空闲或命令行使用该配置运行了几个月了.

I use numpy + scipy + matplotlib on Mac-OSX 10.8.5. I have numpy 1.6.1 on my machine and using python 2.7.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/. I've been running with that configuration for several months running from Idle or the command line.

我刚刚从Sourceforge的.dmg文件升级到matplotlib 1.3.1.安装工作正常,我可以在matplotlib.__version__中看到正确的版本.但是,我无法使用它,因为它声称我需要numpy 1.7或更高版本.因此,我从Sourceforge下载了numpy-1.8.0 dmg文件,并使用Mac安装程序进行了安装.安装程序声称已正确完成安装,但是numpy.__version__仍为1.6.1!我已经完成了多次安装(根据Mac安装程序每次都成功完成了安装),结果相同.

I just upgraded to matplotlib 1.3.1 from the .dmg file at Sourceforge. The install worked fine and I can see the correct version in matplotlib.__version__. However, I cannot use it because it claims I need numpy 1.7 or higher. So I downloaded the numpy-1.8.0 dmg file from Sourceforge and installed it using the Mac installer. The installer claims to have done it correctly, but numpy.__version__ is still 1.6.1!!! I've done the installation multiple times (each time successfully according to the Mac installer) with the same result.

我在Sourceforge上使用各自的.dmg文件将matplotlib升级到1.3.1并将scipy升级到0.13没问题.我不明白为什么numpy不应该以相同的方式安装.我以前必须以相同的方式升级它,但我不记得了.

I had no problem upgrading matplotlib to 1.3.1 and scipy to 0.13 using their respective .dmg files at Sourceforge. I don't see why numpy should not install the same way. I must have upgraded it the same way in the past, but I can't remember.

我从Idle以及从命令行运行Python,并且不想去Macports等其他发行版.我已经以这种方式使用Python 4年了,不明白为什么numpy是没有更新.感谢您的帮助.

I run Python from Idle as well as from the command line and don't want to go to some other distribution like Macports, etc. I've been using Python this way for 4 years and don't understand why numpy is not being updated. Thanks for any help.

推荐答案

三种解决方案,一种是我的评论中给出的解决方案,但更简单的一种可能是更改您的PYTHONPATH.在命令行上:

Three solutions, one is the one given in my comment, but an easier one might be to change your PYTHONPATH. On the command line:

export PYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/:$PYTHONPATH

要使更改永久生效,请将该行放入您的

To make the change permanent, put that line in your

~/.bashrc

文件.

根据我的评论:
我不确定这有多危险,但是只要将安装移到与您的其他人一起,您可以尝试

From my comment:
I'm not sure how dangerous it is, but to just move the installation to be with your others, you could try

mv /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/n‌​umpy/ /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/n‌​umpy_old/
cp /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/nump‌​‌​y/ /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/n‌​umpy/


最后,您可以尝试使用pip安装numpy.要查看pip的安装位置,请在终端中键入以下内容:


Finally, you could try using pip to install numpy. To see where pip is installed, type this in terminal:

which pip

如果它是您想要的位置(/Library/...),那么您要做的就是

If it's where you want it to be (/Library/...), then all you have to do is

pip install numpy

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

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