(Python 模块序列号)没有名为 utilities.compatibility 的模块

(Python module serial) No module named utilities.compatibility

我正在尝试构建 PiPhone ^1,但是当我执行 python piphone.py 时,我收到以下信息:

我似乎找不到其他人遇到过这个问题。大家建议我用什么方法解决这个问题?

  1. https://github.com/climberhunt/PiPhone

我已经使用了 pip uninstall serial,但我还没有得到很好的解决方案。

Traceback (most recent call last):
  File "ttest.py", line 2, in <module>
    import serial
  File "/home/pi/.local/lib/python2.7/site- 
packages/serial/__init__.py", line 10, in <module>
    from . import utilities, abc, model, marshal, errors, 
properties, meta, hooks, test, request
  File "/home/pi/.local/lib/python2.7/site- 
packages/serial/model.py", line 11, in <module>
    from .utilities.compatibility import backport, 
BACKWARDS_COMPATIBILITY_IMPORTS
ImportError: No module named utilities.compatibility

你安装了错误的包。您已安装 serial, which is a Python package to handle object serialisation and deserialisation from and to YAML, JSON and XML and appears to be broken at the moment (I don't think the author is all that experienced in Python package development yet). Someone else already filed an issue with the package to have it renamed.

您想安装 pyserial,这是一个处理串口连接的库。