【发布时间】:2019-11-04 11:06:20
【问题描述】:
我有一个使用 pexpect、pyserial 模块的旧脚本。在我重新安装 Windows 之前,我运行得非常好。如果不显示以下内容,我现在无法使其运行;
Traceback (most recent call last):
File "C:\Program Files\Guidance Automation Ltd\kingpiN Programming\KingpinProgramming.py", line 7, in <module>
from pexpect_serial import SerialSpawn
File "C:\Program Files\Python37\lib\site-packages\pexpect_serial\__init__.py", line 1, in <module>
from .serial_spawn import SerialSpawn
File "C:\Program Files\Python37\lib\site-packages\pexpect_serial\serial_spawn.py", line 24, in <module>
from pexpect import spawn
ImportError: cannot import name 'spawn' from 'pexpect' (C:\Program Files\Python37\lib\site-packages\pexpect\__init__.py)
我尝试了多种安装 pexpect_serial、pexpect 和 pyserial 模块的组合,以及多个版本的 python,但仍然无济于事。 这似乎是 pexpect-serial 模块的问题。
文件的开头显示为这样;
import sys
import time
import os
import serial
import pexpect.fdpexpect
import pexpect.popen_spawn
from pexpect_serial import SerialSpawn
import paramiko
from config import *
【问题讨论】:
标签: python windows pyserial pexpect