pexpect-2.3安装方法

所用系统: Centos7


[root@xinsz-py01 python]# wget http://pexpect.sourceforge.net/pexpect-2.3.tar.gz


--2017-09-06 06:26:33--  http://pexpect.sourceforge.net/pexpect-2.3.tar.gz
正在解析主机 pexpect.sourceforge.net (pexpect.sourceforge.net)... 216.34.181.96
正在连接 pexpect.sourceforge.net (pexpect.sourceforge.net)|216.34.181.96|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:150868 (147K) [application/x-gzip]
正在保存至: “pexpect-2.3.tar.gz”

100%[=======================================>] 150,868      264KB/s 用时 0.6s   

2017-09-06 06:26:34 (264 KB/s) - 已保存 “pexpect-2.3.tar.gz” [150868/150868])

[root@xinsz-py01 python]# tar xf pexpect-2.3.tar.gz
 
[root@xinsz-py01 python]# cd pexpect-2.3/

[root@xinsz-py01 pexpect-2.3]# ls


ANSI.py  examples      FSM.py   LICENSE     PKG-INFO  README     setup.py

doc      fdpexpect.py  INSTALL  pexpect.py  pxssh.py  screen.py



[root@xinsz-py01 pexpect-2.3]# python ./setup.py install


running install
running build
running build_py
creating build
creating build/lib
copying pexpect.py -> build/lib
copying pxssh.py -> build/lib
copying fdpexpect.py -> build/lib
copying FSM.py -> build/lib
copying screen.py -> build/lib
copying ANSI.py -> build/lib
running install_lib
copying build/lib/pexpect.py -> /usr/lib/python2.7/site-packages
copying build/lib/pxssh.py -> /usr/lib/python2.7/site-packages
copying build/lib/fdpexpect.py -> /usr/lib/python2.7/site-packages
copying build/lib/FSM.py -> /usr/lib/python2.7/site-packages
copying build/lib/screen.py -> /usr/lib/python2.7/site-packages
copying build/lib/ANSI.py -> /usr/lib/python2.7/site-packages
byte-compiling /usr/lib/python2.7/site-packages/pexpect.py to pexpect.pyc
byte-compiling /usr/lib/python2.7/site-packages/pxssh.py to pxssh.pyc
byte-compiling /usr/lib/python2.7/site-packages/fdpexpect.py to fdpexpect.pyc
byte-compiling /usr/lib/python2.7/site-packages/FSM.py to FSM.pyc
byte-compiling /usr/lib/python2.7/site-packages/screen.py to screen.pyc
byte-compiling /usr/lib/python2.7/site-packages/ANSI.py to ANSI.pyc
running install_egg_info

Writing /usr/lib/python2.7/site-packages/pexpect-2.3-py2.7.egg-info


[root@xinsz-py01 pexpect-2.3]# python


Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2

Type "help", "copyright", "credits" or "license" for more information.


>>> import pxssh

>>>


没有报错,就可以使用了.


pxssh 常用 的 三个 方法 如下:

·login() 建立 ssh 连接;

·logout() 断开 连接;

·prompt() 等待 系统 提示符, 用于 等待 命令 执行 结束。

上一篇:痞子衡嵌入式:语音处理工具pzh-speech诞生记(1)- 环境搭建(Python2.7.14 + PyAudio0.2.11 + Matplotlib2.2.3 + SpeechRecogniti


下一篇:linux下安装pip