28

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
  • 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. Commented Oct 2, 2019 at 23:15

1 Answer 1

38

Install the libffi development package:

sudo apt-get install libffi-dev 

and try again.

Sign up to request clarification or add additional context in comments.

2 Comments

I have the same problem as OP, but do not have administrator rights, and cannot run sudo commands. What is the easiest solution in that case?
manually download the libffi-dev ubuntu package and extract the package, then define environment variable LIBRARY_PATH to point to the library folder which you just extracted and try to build

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.