ModuleNotFoundError: No module named '_ctypes' when installing pip

Viewed 13203

On my RHEL 7.x system, I have system level python2.7 in /usr/bin and python3.7 in /usr/local/bin. I am trying to install pip for my python3.7 but I get "ModuleNotFoundError: No module named '_ctypes'" error. I did install libffi-devel but the issue still persists.

I installed libffi-devel using yum install libffi-devel I have downloaded the get_pip file from here: sudo wget https://bootstrap.pypa.io/get-pip.py Now when I run sudo /usr/local/bin/python3.7 get-pip.py I get the described error

Also, I tried sudo /usr/local/bin/python3.7 -m ensurepip which gives me the same error.

How can I get pip installed successfully for my python3.7

1 Answers

Install the libffi development package:

sudo apt-get install libffi-dev

and compile again.

Related