Matplotlib is currently using agg, which is a non-GUI backend 和 ImportError: No module named 'Tkinter' [closed]


跑maskrcnn報錯:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
% get_backend())
可以在第一部分增加一行代碼:
matplotlib.use(‘TkAgg’)

最后顯示如下:

import matplotlib

matplotlib.use('TkAgg')

import matplotlib.pyplot as plt

 

於是嘗試直接安裝tkinter,結果沒有發現tkinter包

linuxidc@linuxidc:~$ pip3 install tkinter

 

於是,執行terminal 命令:

linuxidc@linuxidc:~/linuxidc.com$ python3 -m tkinter

linuxidc@linuxidc:~$ sudo apt search python3-tk

linuxidc@linuxidc:~$ sudo apt install python3-tk

 

在安裝完成之后,重新執行程序,然后報出同樣的錯誤,問題仍然存在。

r如果發現有信息說,需要安裝tk的開發類庫,直接進行安裝:

sudo apt install tk-dev (Ubuntu/Debian)

yum install tk-devel (CentOS)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM