我正在尝试测试 tensorflow 对象检测。因为tensorflow需要python3.6,而我的系统默认安装了python3.7.1,所以我从源代码构建了python3.6.7。然后我用 python3.6.7 创建了一个 venv 并安装了我所有的依赖项,但我最终在尝试导入 matplotlib 时出现错误并得到以下错误:
File "detection.py", line 9, in <module>
from matplotlib import pyplot as plt
File "/home/johnmadden/repos/tfobj/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2374, in <module>
switch_backend(rcParams["backend"])
File "/home/johnmadden/repos/tfobj/lib/python3.6/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/home/johnmadden/repos/tfobj/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/johnmadden/repos/tfobj/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "/home/johnmadden/repos/tfobj/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 5, in <module>
import tkinter as Tk
File "/usr/local/lib/python3.6/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
我在网上查看,发现我需要安装 tk
pacman -S tk
而且我仍然遇到相同的错误,但是当我转到 python3.7.1 时,它成功导入。我认为它正在尝试为 python3.7.1 而不是 python3.6.7 安装它。我知道在 ubuntu 上人们可以做到
sudo apt-get install python3-tk
这将如何在 arch 上完成?
慕标琳琳
相关分类