Pexpect is on PyPI, and can be installed with standard tools:

pip install pexpect


easy_install pexpect


This version of Pexpect requires Python 3.3 or above, or Python 2.7.

As of version 4.0, Pexpect can be used on Windows and POSIX systems. However, pexpect.spawn and are only available on POSIX, where the pty module is present in the standard library. See Pexpect on Windows for more information.