3
votes

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
Have you compiled Python yourself? Did you recompile after installing libffi-devel? - phd
How can I do that? @phd - user4108565
Same way as you have compiled it for the first time. - hoefling
I removed the existing python3.7, installed and compiled it again , the issue is resolved. Thanks - user4108565
I had this issue using python 3.7.5, the issue did not happen when I tried with python 3.7.1 - airin

1 Answers

2
votes

Install the libffi development package:

sudo apt-get install libffi-dev

and compile again.