无法在PyDev中导入matplotlib [英] Unable to import matplotlib in PyDev

查看:153
本文介绍了无法在PyDev中导入matplotlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 10.04并已成功配置PyDev以使用Python并编写了一些简单的示例项目。现在我正在尝试合并numpy和matplotlib。我已经安装了numpy并且在PyDev中我不需要改变任何路径等,并且在安装numpy之后我自动能够导入numpy没有问题。但是,使用matplotlib执行相同的过程并没有奏效。如果我从命令行运行Python,那么导入matplotlib就可以了。但是在PyDev中,我只是得到标准错误,当我尝试导入matplotlib时无法找到matplotlib。

I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automatically able to import numpy with no problem. However, following the same procedure with matplotlib hasn't worked. If I run Python from the command line, then import matplotlib works just fine. But within PyDev, I just get the standard error where it can't locate matplotlib when I try import matplotlib.

由于numpy不需要对PYTHONPATH进行任何更改,我觉得matplotlib也不应该,所以任何人都可以帮我弄清楚为什么在我的现有项目中无法访问matplotlib而numpy是什么?感谢您的帮助。

Since numpy didn't require any alteration of the PYTHONPATH, I feel that neither should matplotlib, so can anyone help me figure out why matplotlib isn't accessible from within my existing project while numpy is? Thanks for any help.

推荐答案

听起来您为Pydev设置的解释器并未指向相应版本的python(即您'安装mpl和np)。在终端中,键入 python 的效果可能等于 env python ; pydev可能没有使用此解释器。

Sounds like the interpreter you setup for Pydev is not pointing to the appropriate version of python (that you've install mpl and np). In the terminal, it's likely the effect of typing python is tantamount to env python; pydev might not be using this interpreter.

但是,如果pydev解释器指向正确的位置,您可能只需要重新解析解释器(基本上,再次设置)以显示mpl。

But, if the pydev interpreter is pointed to the right location, you might simply have to rehash the interpreter (basically, set it up again) to have mpl show up.

你可以在终端试试这个,看看结果是否不同:

You could try this in the terminal and see if the results are different:

python -c'导入平台; print platform.python_version()'

$ {PYTHONPATH} / python -c'导入平台; print platform.python_version()'

这篇关于无法在PyDev中导入matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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