[英]How to install matplotlib for particular version of Python?
I have installed scipy and numpy, and they are being used with my current, desired version of python 2.7.6 (I am running on OSX Mavericks and had to upgrade.) However, when I pip
installed matplotlib, by default it referenced my previous python version, 2.7.5, thus making it troublesome to use (obviously.) 我已经安装了scipy和numpy,它们正在与我当前所需的python 2.7.6版本一起使用(我在OSX Mavericks上运行并必须升级。)但是,当我
pip
安装matplotlib时,默认情况下它引用了我以前的版本。 python版本2.7.5,因此使用起来很麻烦(显然)。
How do I change which version of python matplotlib uses so I can import and use the library? 如何更改使用哪个版本的python matplotlib,以便可以导入和使用该库?
Thanks. 谢谢。
The way I would solve this problem is like this, firstly one would need to go into your 2.7.6 directory, and under the Scripts
folder you will find the pip
executable. 我要解决此问题的方法是这样的,首先需要进入2.7.6目录,然后在
Scripts
文件夹下找到pip
可执行文件。 My suggestion is (because its difficult to debug this kind of people without having all the details) is this: 我的建议是(因为在没有全部细节的情况下很难调试此类人员)是这样的:
./pip install matplotlib
And see if this succeeds, otherwise, I suggest using pyenv
to manage your python installations. 并查看是否成功,否则,建议使用
pyenv
来管理您的python安装。
I suggest you use Macports for installing additional Python versions on OS X. Once Macports is installed, it's fairly easy to install Python 2.7.6. 我建议您使用Macports在OS X上安装其他Python版本。安装Macports之后,安装Python 2.7.6相当容易。 All you'd have to do is:
您要做的就是:
sudo port install python27
Now, you should be able to get all the libraries you need just as easily, using, too, Macports. 现在,您应该也可以使用Macports轻松获得所需的所有库。
sudo port install py27-numpy
sudo port install py27-scipy
sudo port install py27-matplotlib
Macports should solve all the dependencies and, of course, link the packages to their correct Python versions, avoiding you a lot of headaches. Macports应该解决所有依赖关系,当然,将软件包链接到其正确的Python版本,可以避免很多麻烦。
For a step by step guide on how to set up a nice, functional Python environment, visit: http://jakevdp.github.io/blog/2013/02/02/setting-up-a-mac-for-python-development/ 有关如何设置良好的功能性Python环境的逐步指南,请访问: http : //jakevdp.github.io/blog/2013/02/02/setting-up-a-mac-for-python-开发/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.