首页 > 解决方案 > 无法卸载 pyserial 来解决问题

问题描述

我想修复此错误 pyserial 和 serial 已安装在 Raspberry Pi 中,但仍然收到此错误

 from serial import Serial  # Importing the serial library to communicate with Arduino
ImportError: cannot import name 'Serial'

当我试图卸载 pyserial 这个结果

Cannot uninstall 'pyserial'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

请问如何解决这个问题

标签: pythonraspberry-pipython-3.5pyserial

解决方案


尝试:

sudo pip install -U pyserial
sudo pip3 install -U pyserial

我认为 pyserial 必须以 root 身份安装,对于所有用户(-U),对于 python 2 和 3 的版本,它才能工作

如果您没有 pip,请从

https://pip.pypa.io/en/stable/installing/


推荐阅读