文档首页> Atlas 200 DK 开发者套件(1.0.7.alpha)> 模型小型化工具使用指导(Caffe)> FAQ> 检测网络量化时提示"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure."
更新时间:2021-03-18 GMT+08:00
分享

检测网络量化时提示"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure."

问题描述

检测网络进行量化时,提示"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure."导致量化后的检测结果未能展示到界面。

可能原因

该问题可能是由于Tkinter未安装好导致,可以在python终端里输入来验证,如果出现如下提示表示未成功安装Tkinter:

hisisoc@ubuntu62:~$ python3.7.5
Python 3.7.5 (default, Mar  3 2020, 13:58:02)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3.7.5/lib/python3.7/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'

解决方案

Tkinter直接通过安装python3-tk未能成功安装可能由于安装了多版本python3导致,也有可能是未能成功安装tk-dev库。若未能成功安装tk-dev库则参见如下方法解决。

  1. 重新安装tk-dev库,命令为:
    sudo apt-get install tk-dev
  2. 进入python3.7.5的安装目录重新编译安装python3.7.5
    cd Python-3.7.5
    ./configure --prefix=/usr/local/python3.7.5 --enable-shared
    make 
    sudo make install
  3. 删除原来的软链接
    sudo rm -rf  /usr/bin/python3.7.5 
    sudo rm -rf  /usr/bin/pip3.7.5
    sudo rm -rf  /usr/bin/python3.7 
    sudo rm -rf  /usr/bin/pip3.7
  4. 重新设置软链接
    sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7.5 
    sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7.5
    sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7 
    sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7
  5. 再次验证,能够成功imprt tkinter模块则表示安装成功:
    hisisoc@ubuntu62:~$ python3.7.5
    Python 3.7.5 (default, Mar  3 2020, 13:58:02)
    [GCC 7.4.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tkinter
    >>>
分享:

    相关文档

    相关产品

close