Python 3.x AttributeError:Roboclaw实例没有属性'_端口';

Python 3.x AttributeError:Roboclaw实例没有属性'_端口';,python-3.x,python-2.7,usb,raspbian,pyserial,Python 3.x,Python 2.7,Usb,Raspbian,Pyserial,我真的尝试过搜索所有的论坛。这令人困惑。Roboclaw的制造商使用Python2.7编写了他们的Python测试脚本(以及Roboclaw类)。到目前为止,它不能与Python3一起使用 所以我被限制住了 当我运行基本脚本时,它抱怨AttributeError:Roboclaw实例没有属性“\u port” 技术支持人员只是不断告诉人们他们需要python 2.7 我已经尝试了sudo-apt-get-install-python-serial。不走运。还是一样的问题 我尝试了sudo apt

我真的尝试过搜索所有的论坛。这令人困惑。Roboclaw的制造商使用Python2.7编写了他们的Python测试脚本(以及Roboclaw类)。到目前为止,它不能与Python3一起使用

所以我被限制住了

当我运行基本脚本时,它抱怨
AttributeError:Roboclaw实例没有属性“\u port”

技术支持人员只是不断告诉人们他们需要python 2.7

我已经尝试了
sudo-apt-get-install-python-serial
。不走运。还是一样的问题

我尝试了
sudo apt get install python3 serial
,只是想看看是否与2.x兼容。不走运

我想做的是吹走所有python并重新安装我需要的东西。但是我读到(?)raspbian/debian使用python进行包管理

错误是:

Traceback(最后一次调用):文件“roboclaw\u simplepwm.py”,第行
14,在rc.ForwardM1(地址,32)#1/4功率转发文件中
“/home/devchu/dev/roboclaw_python/roboclaw_python/roboclaw.py”,第行
647,在ForwardM1中返回self._write1(地址,self.Cmd.M1FORWARD,val)
文件“/home/devchu/dev/roboclaw_python/roboclaw_python/roboclaw.py”,
第311行,在_write1self._sendcommand(address,cmd)文件中
“/home/devchu/dev/roboclaw_python/roboclaw_python/roboclaw.py”,第行
126,在_sendcommandself._port.write(chr(address))**属性错误:
Roboclaw实例没有属性“\u port”**

可以看到机械手装置
dmesg
)。我还运行了他们的非常基本的脚本,它只执行一个
open()
,这个脚本可以正常工作

dpkg --get-selections|grep python<br/>
dh-python install<br/>
libpython-stdlib:armhf install<br/>
libpython2.7-minimal:armhf install<br/>
libpython2.7-stdlib:armhf install<br/>
libpython3-stdlib:armhf install<br/>
libpython3.5:armhf install<br/>
libpython3.5-minimal:armhf install<br/>
libpython3.5-stdlib:armhf install<br/>
python install<br/>
python-apt-common install<br/>
python-minimal install<br/>
python-serial install<br/>
python2.7 install<br/>
python2.7-minimal install<br/>
python3 install<br/>
python3-apt install<br/>
python3-minimal install<br/>
python3-serial install<br/>
python3.5 install<br/>
python3.5-minimal install<br/>
dpkg——获取选择| grep python
dh python安装
libpython stdlib:armhf安装
libpython2.7-minimal:armhf安装
libpython2.7-stdlib:armhf安装
libpython3stdlib:armhf安装
libpython3.5:armhf安装
libpython3.5-minimal:armhf安装
libpython3.5-stdlib:armhf安装
python安装
python apt通用安装
python最小安装
python串行安装
python2.7安装
python2.7-最小安装量
python3安装
python3 apt安装
python3最小安装量
python3串行安装
python3.5安装
python3.5-最小安装量

我从去年年底开始运行Raspberry/Raspbian(我认为这是一种延伸)。

试试
sudopython[你的文件名]

例如,
sudopython包\u serial.py

我试图运行
packet\u serial.py
。将根阻止对文件中设置的组件所做的更改。因此,您得到的错误是Roboclaw没有属性“\u port”。添加
sudo
对我很有效