'ModuleNotFoundError: No module named 'pexpect'

My python script is throwing error while trying to import pexpect

python3 amf_bringup.py
Traceback (most recent call last):
File "amf_bringup.py", line 1, in <module>
import pexpect
ModuleNotFoundError: No module named 'pexpect'

I have already installed pexpect

sudo python3 -m pip install pexpect
Requirement already satisfied: pexpect in /usr/local/lib/python3.6/site-packages (4.8.0)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect) (0.7.0)

Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source