Raspberry Pi ---- 读取 Rockwell .dbf 文件

Raspberry Pi ---- Reading Rockwell .dbf files

我正在使用 Raspberry Pi 使用最新的 Raspbian Stretch with desktop 从罗克韦尔 PLC 中提取 .dbf 文件。 我运行

sudo apt-get updates
sudo apt-get upgrade
pip install dbfread

没有错误。

正在尝试读取 .dbf 文件但无法通过以下错误

Traceback (most recent call last):
  File "/home/pi/TimeRiteMst/DBF.py", line 2, in <module>
    from dbfread import DBF
ImportError: No module named 'dbfread'

正在阅读https://pypi.org/project/dbfread/ and https://dbfread.readthedocs.io/en/latest/.

这应该适用于 Python 3:

from dbfread import DBF

for record in DBF('/home/pi/test.DBF'):
    print(record)

尝试:

python -m pip install --user dbfread
python <your-script.py>

目标是对两个命令使用相同的 Python 解释器。