【问题标题】:can't uninstall pyserial to fix issues无法卸载 pyserial 来解决问题
【发布时间】:2019-08-31 16:11:05
【问题描述】:

我想修复这个错误 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.

请问这个问题怎么解决

【问题讨论】:

  • 我的文件名 testing.py
  • pyserial 是一个 python - 据我所知,唯一的库,所以你需要做的就是从你的“站点包”中删除目录
  • 不在站点和磁盘包中
  • 然后使用import serial; print(serial.__file__) 找到它。

标签: python raspberry-pi python-3.5 pyserial


【解决方案1】:

试试:

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

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

如果你没有 pip,从那里获取它

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

【讨论】:

  • 我试过命令;结果'无法卸载'pyserial'。这是一个 distutils 安装的项目,因此我们无法准确确定哪些文件属于它,这只会导致部分卸载。 '
  • sudo pip3 install --ignore-installed -U pyserial 使用最新版本安装 pyserial 而忽略 distutils 安装的版本对我有用
猜你喜欢
  • 1970-01-01
  • 2019-08-17
  • 2018-05-24
  • 1970-01-01
  • 2011-07-21
  • 1970-01-01
  • 1970-01-01
  • 2012-11-16
  • 1970-01-01
相关资源
最近更新 更多