2016-10-22 34 views
0

在Ubuntu 16.04上,我有一个virtualenv(15.0.2)。我没有安装matplotlib 1.5.3,我得到这个错误:在Ubuntu的virtualenv上安装matplotlib的python tk

import _tkinter # If this fails your Python may not be configured for Tk 
ImportError: libBLT.2.4.so.8.6: cannot open shared object file: No such file or directory 

感谢

+0

我有这个问题早发现,但它不”不要提起诉讼irtualenv。 –

+2

我已经解决了这个问题,这要归功于这个http://stackoverflow.com/questions/29433824/unable-to-import-matplotlib-pyplot-as-plt-in-virtualenv/33447513输入命令“pip uninstall matplotlib”和“pip在我的virtualenv上安装matplotlib == 1.4.3“。 –

回答

0

我假设你使用python3。

首先,在你的python shell中键入help('modules')。这应该返回当前安装的所有模块。如果tkinter没有在那里列出,请尝试以下操作:

import sysconfig 
print(sysconfig.get_paths()) 

这将打印出python查找模块的所有路径。 移动你的Tkinter模块上面列出的一个文件夹(通常应该是站点包但这可能取决于你的Python建立。

如果仍然不能解决问题,请尝试

sudo apt-get install python python-tk idle python-pmw python-imaging 

如果您在使用Ubuntu,Python库应包括Tkinter的。因此,上面的代码重新安装Python。

希望我能帮上忙, Narusan

+0

对不起,数据缺失,我正在使用python 2.7.9。我确实试图在标准的python安装(/ usr/bin/..)中安装matplotlib,它完美的工作,所以我想我有所有的库。当我用我的virtualenv解释器运行代码时,问题就出现了。在这种情况下,tk有些问题,它不能使用命令在virtualenv上安装: –

+0

cd .../path/to/env,source/bin/activate,pip install tk –

+0

看起来命令“sudo apt-get安装python python-tk idle python-pmw python-imaging“确实解决了我的问题。对不起,我不能+1你的答案。非常感谢!!!! –

相关问题