Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyenv fails with : ModuleNotFoundError: No module named '_ctypes' error

Tags:

python

I have already seen https://bugs.python.org/issue34036 but it did not help.

I am trying to instal python using the followin command

 pyenv install 3.7.0

But it throws the following error

If the version you need is missing, try upgrading pyenv:

Downloading Python-3.7.0.tar.xz... -> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz Installing Python-3.7.0...

BUILD FAILED (Ubuntu 16.04 using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20181018113151.14218 Results logged to /tmp/python-build.20181018113151.14218.log

Last 10 log lines: File "/tmp/tmpecnjnct9/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/init.py", line 42, in

File "/tmp/tmpecnjnct9/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in

File "/tmp/tmpecnjnct9/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in

File "/tmp/tmpecnjnct9/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in

File "/tmp/tmpecnjnct9/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in

File "/tmp/python-build.20181018113151.14218/Python-3.7.0/Lib/ctypes/init.py", line 7, in

from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'

Makefile:1122: recipe for target 'install' failed

make: *** [install] Error 1

like image 983
Sugumar Venkatesan Avatar asked Oct 18 '18 06:10

Sugumar Venkatesan


1 Answers

Install the libffi development package:

sudo apt-get install libffi-dev

and try again.

like image 90
SwKEmb Avatar answered Oct 18 '22 22:10

SwKEmb