Ubuntu 16.04 LTS Eu instalei o matplotlib no meu virtualenv com o python 3.5.2.
import matplotlib
funciona bem, mas quando tento import matplotlib.pyplot
, o OUTPUT é:
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 36, in <module>
import _tkinter
ImportError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 4, in <module>
from . import tkagg # Paint image to Tk photo blitter extension.
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/matplotlib/backends/tkagg.py", line 5, in <module>
from six.moves import tkinter as Tk
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/six.py", line 92, in __get__
result = self._resolve()
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/home/marcin/Documents/matplotlib/lib/python3.5/site-packages/six.py", line 82, in _import_module
__import__(name)
File "/usr/lib/python3.5/tkinter/__init__.py", line 38, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
Eu digitei sudo apt-get install python3-tk
o OUTPUT é:
python3-tk is already the newest version (3.6.5-3~16.04.york0.2).
The following packages were automatically installed and are no longer required:
linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic linux-headers-4.4.0-119 linux-headers-4.4.0-119-generic linux-headers-4.4.0-121 linux-headers-4.4.0-121-generic linux-headers-4.8.0-36
linux-headers-4.8.0-36-generic linux-image-4.13.0-38-generic linux-image-4.8.0-36-generic linux-image-extra-4.13.0-38-generic linux-image-extra-4.8.0-36-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
Eu digitei sudo apt-get install python3.5-tk
o OUTPUT é:
Package python3.5-tk is a virtual package provided by:
python3-tk 3.5.1-1 [Not candidate version]
E: Package 'python3.5-tk' has no installation candidate
Como usar o pyplot sem erros?