Pexpect installation

Since this is the first package we will install, we will install both the pip tool with the pexpect package. The process is pretty straightforward:

sudo apt-get install python-pip #Python2sudo apt-get install python3-pipsudo pip3 install pexpectsudo pip install pexpect #Python2
I am using pip3 to install Python 3 packages, while using pip to install packages in the Python 2 environment.

Do a quick to test to make sure the package is usable:

>>> import pexpect>>> dir(pexpect)['EOF', 'ExceptionPexpect', 'Expecter', 'PY3',   'TIMEOUT', '__all__', '__builtins__', '__cached__',   '__doc__', '__file__', '__loader__', '__name__',   '__package__', '__path__', '__revision__',   '__spec__', '__version__', 'exceptions', 'expect', 

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.