python串行端口

python串行端口,python,linux,pyserial,Python,Linux,Pyserial,我想用python与我的串行端口通信。我为linux安装了pyserial和uspp: import serial ser = serial.Serial('/dev/pts/1', 19200, timeout=1) print ser.portstr #check which port was really used ser.write("hello") #write a string ser.close() # 它给出了以下错误: Trace

我想用python与我的串行端口通信。我为linux安装了pyserial和uspp:

import serial
ser = serial.Serial('/dev/pts/1', 19200, timeout=1)
print ser.portstr       #check which port was really used
ser.write("hello")      #write a string
ser.close()             #
它给出了以下错误:

Traceback (most recent call last):
  File "poi.py", line 5, in <module>
    ser.open()   
  File "/usr/local/lib/python2.6/dist-packages/pyserial-2.5-py2.6.egg/serial/serialposix.py", line 276, in open
    raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/tyUSB1: [Errno 2] No such file or directory: '/dev/tyUSB1'
回溯(最近一次呼叫最后一次):
文件“poi.py”,第5行,在
爵士公开赛()
打开文件“/usr/local/lib/python2.6/dist packages/pyserial-2.5-py2.6.egg/serial/serialposix.py”,第276行
raise SerialException(“无法打开端口%s:%s”%(self.\u port,msg))
serial.serialutil.SerialException:无法打开端口/dev/tyUSB1:[Errno 2]没有这样的文件或目录:'/dev/tyUSB1'

如果您使用linux,通常串行端口的名称为
/dev/tty*
;只需将
*
替换为
s
和端口号,如
/dev/ttyS1
。我使用通过usb串行通信的arduino,它可能是