错误发生在 Raspberry Pi 上的 import 语句 (Linux rp3b 5.10.17-v7+ #1414 SMP 4 月 30 日星期五 13:18:35 BST 2021 armv7l GNU/Linux )在做事之前。这是怎么回事?
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import io
import subprocess
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates
import pandas as pd
import datetime
运行 python 脚本给出:
Traceback (most recent call last):
File "./plotGasPerMonth.py", line 9, in <module>
import pandas as pd
File "/home/pi/.local/lib/python3.7/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import (
File "/home/pi/.local/lib/python3.7/site-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/home/pi/.local/lib/python3.7/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
from pandas.util.version import Version
File "/home/pi/.local/lib/python3.7/site-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/home/pi/.local/lib/python3.7/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/home/pi/.local/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
File "pandas/_libs/hashtable.pyx", line 1, in init pandas._libs.hashtable
File "pandas/_libs/missing.pyx", line 1, in init pandas._libs.missing
File "/home/pi/.local/lib/python3.7/site-packages/pandas/_libs/tslibs/__init__.py", line 31, in <module>
from pandas._libs.tslibs.conversion import (
File "pandas/_libs/tslibs/conversion.pyx", line 63, in init pandas._libs.tslibs.conversion
File "pandas/_libs/tslibs/parsing.pyx", line 1, in init pandas._libs.tslibs.parsing
File "pandas/_libs/tslibs/offsets.pyx", line 1, in init pandas._libs.tslibs.offsets
File "pandas/_libs/tslibs/timedeltas.pyx", line 61, in init pandas._libs.tslibs.timedeltas
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 14: invalid start byte
pandas 已安装
apt install python3-pandas