The pip3 show command can be used to determine if Ansible is installed.
pip3 show ansible
Something like this should be returned. In this example, Ansible version 2.9.12 is installed.
Name: ansible Version: 2.9.12 Summary: Radically simple IT automation Home-page: https://ansible.com/ Author: Ansible, Inc. Author-email: firstname.lastname@example.org License: GPLv3+ Location: /root/.local/lib/python3.6/site-packages Requires: jinja2, PyYAML, cryptography
The hash command caches the paths to commands, and if a command is relocated then bash will not pick it up unless that cache is cleared. Issue the following command to clear Ansible from the cache.
hash -d ansible
Use pip3 to uninstall ansible.
pip3 uninstall ansible
Something like this should be returned.
Found existing installation: ansible 2.9.12 Uninstalling ansible-2.9.12: Would remove: /usr/local/bin/ansible /usr/local/bin/ansible-config /usr/local/bin/ansible-connection /usr/local/bin/ansible-console /usr/local/bin/ansible-doc /usr/local/bin/ansible-galaxy /usr/local/bin/ansible-inventory /usr/local/bin/ansible-playbook /usr/local/bin/ansible-pull /usr/local/bin/ansible-test /usr/local/bin/ansible-vault /usr/local/lib/python3.6/site-packages/ansible-2.9.12-py3.6.egg-info /usr/local/lib/python3.6/site-packages/ansible/* /usr/local/lib/python3.6/site-packages/ansible_test/* Would not remove (might be manually added): /usr/local/lib/python3.6/site-packages/ansible_test/_data/injector/ansible-inventory Proceed (y/n)? y Successfully uninstalled ansible-2.9.12
The pip3 show command should now return something like this.
WARNING: Package(s) not found: ansible