18
votes

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

1
For this and related issues, you'll find it best to first meet the general pyenv build prerequisites documented at github.com/pyenv/pyenv/wiki/Common-build-problems and note the troubleshooting instructions there.nealmcb

1 Answers

27
votes

Install the libffi development package:

sudo apt-get install libffi-dev

and try again.