Skip to content

Instantly share code, notes, and snippets.

@solaris9000
Last active March 9, 2018 14:46
Show Gist options
  • Save solaris9000/42a869d021c060cd1dc8374f851aa986 to your computer and use it in GitHub Desktop.
Save solaris9000/42a869d021c060cd1dc8374f851aa986 to your computer and use it in GitHub Desktop.
How to install latest pexpect for RHEL7 manually for use in Ansible
How to install pexpect on RHEL7 for Ansible purposes
1. Download the sources for pexpect-4.4.0 and ptyprocess-0.5.2
here:
https://pypi.python.org/pypi/pexpect
https://pypi.python.org/pypi/ptyprocess
2. Extract the tarballs
3. Goto dir for ptyprocess and type:
python setup.py install
4. Goto dir for pexpect and type:
python setup.py install
You may get this error:
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running install_lib
byte-compiling /usr/lib/python2.7/site-packages/pexpect/_async.py to _async.pyc
File "/usr/lib/python2.7/site-packages/pexpect/_async.py", line 18
transport, pw = yield from asyncio.get_event_loop()\
^
SyntaxError: invalid syntax
running install_egg_info
Removing /usr/lib/python2.7/site-packages/pexpect-4.4.0-py2.7.egg-info
Writing /usr/lib/python2.7/site-packages/pexpect-4.4.0-py2.7.egg-info
This error relates to Python3 and can be ignored.
5. Start python and import pexpect. You should just get prompt back.
OR use
python -c "import pexpect"
echo $?
will return 0 without any errors.
NOTE:
The above is for root. If you want to use for local user then append the above python install commands with --user
and install the packages as the user and not root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment