$ pip3 install matplotlib
Requirement already satisfied: matplotlib in /home/vorac/.local/lib/python3.7/site-packages (3.0.3)
Requirement already satisfied: cycler>=0.10 in /home/vorac/.local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /home/vorac/.local/lib/python3.7/site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/vorac/.local/lib/python3.7/site-packages (from matplotlib) (2.3.0)
Requirement already satisfied: numpy>=1.10.0 in /home/vorac/.local/lib/python3.7/site-packages (from matplotlib) (1.16.3)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/vorac/.local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from kiwisolver>=1.0.1->matplotlib) (40.8.0)一切都很好。现在:
$ python3
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
>>>
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "", line 1, in
File "/home/vorac/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2372, in
switch_backend(rcParams["backend"])
File "/home/vorac/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/vorac/.local/lib/python3.7/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in
from . import _backend_tk
File "/home/vorac/.local/lib/python3.7/site-packages/matplotlib/backends/_backend_tk.py", line 5, in
import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'真奇怪。
$ pip3 install tkinter
Collecting tkinter
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/tkinter/该页面真正包含的只是"404找不到“的文本。在这种情况下我该怎么办。我正在尝试将软件包安装到本地的$HOME上,但是系统范围的安装也可以工作。
发布于 2019-05-08 08:21:05
因为您正在使用Debian,而且您感兴趣的模块可以作为包使用,所以我们可以使用这些模块来解决您的问题。在这样的情况下,如果使用模块的一部分需要另一个模块,而该模块不是第一个严格依赖关系的一部分,那么可能有一个可选的依赖项来解决您的问题;matplotlib的包是python3-matplotlib,所以
apt show python3-matplotlib将告诉我们该模块推荐或建议的可选依赖项。在这种情况下,python3-tk被列出,并且似乎是一个可能的候选人,这是由
apt show python3-tk所以
sudo apt install python3-tk应该能解决你的问题。
https://unix.stackexchange.com/questions/517717
复制相似问题