UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cai

import matplotlib.pyplot as plt
/home/yttt/.local/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3agg.py:17: UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cairocffi.
  "The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "
>>> import scipy.io as sio
>>> import numpy as np
>>> from torch.utils.data import Dataset,DataLoader
>>> from sklearn.metrics import confusion_matrix
import os>>> import os
>>> import time
>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pandas-0.22.0-py3.6-linux-armv7l.egg/pandas/__init__.py", line 58, in <module>
    from pandas.io.api import *
  File "/usr/local/lib/python3.6/dist-packages/pandas-0.22.0-py3.6-linux-armv7l.egg/pandas/io/api.py", line 19, in <module>
    from pandas.io.packers import read_msgpack, to_msgpack
  File "/usr/local/lib/python3.6/dist-packages/pandas-0.22.0-py3.6-linux-armv7l.egg/pandas/io/packers.py", line 68, in <module>
    from pandas.util._move import (
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 2: invalid start byte
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pandas-0.22.0-py3.6-linux-armv7l.egg/pandas/__init__.py", line 51, in <module>
    plot_params = pandas.plotting._style._Options(deprecated=True)
AttributeError: module 'pandas' has no attribute 'plotting'
>>> exit()
yttt@xilinx:~/yt$ python3
Python 3.6.9 (default, Jun 29 2022, 11:45:57)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> exit()
yttt@xilinx:~/yt$
yttt@xilinx:~/yt$ python3
Python 3.6.9 (default, Jun 29 2022, 11:45:57)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> matplotlib.use("Pdf")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'matplotlib' is not defined
>>> import  matplotlib
>>> matplotlib.use("Pdf")
>>> import matplotlib.pyplot as plt
>>> import pandas as pd
>>> exit()

在import matplotlib.pyplot as plt时报错:
/home/yttt/.local/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3agg.py:17: UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cairocffi.
  "The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "

解决办法:

在代码import matplotlib.pyplot as plt前添加:

import  matplotlib

matplotlib.use("Pdf")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值