2

I am trying to install Python 3.7.1 so I wont break the system, but pyenv always get error. I installed pyenv per this link:How do I install Python 3.6 using apt-get?

Where it says install pyenv and it seems to work, but fails to install Python3.7.1

Can someone please help me? what is the next step to find the problem?

$ pyenv install 3.7.1

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

    BUILD FAILED (Ubuntu 18.04 using python-build 1.2.8)

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

    Last 10 log lines:
      File "/tmp/tmpgu4s65ck/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in 
      File "/tmp/tmpgu4s65ck/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in 
      File "/tmp/tmpgu4s65ck/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in 
      File "/tmp/tmpgu4s65ck/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in 
      File "/tmp/tmpgu4s65ck/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in 
      File "/tmp/python-build.20181117140343.4690/Python-3.7.1/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
  • not to solve specific problem but to give you python3.7.1, just use anaconda link – sleepyhead Nov 18 '18 at 12:50
  • Hi, Sorry about the edit issue, I got it solved pyenv did not install libffi-dev, so I sudo apt-get install libffi-dev pyenv works Great now and installed Python 3.71 and 3.6.7 also – STKEX-Taz Nov 19 '18 at 0:53
3

install missing build tools

sudo apt-get install build-essential git libreadline-dev zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev libffi-dev

then install python 3.7.1 via pyenv

pyenv install 3.7.1

not to be cocky, but you're probably just missing libffi-dev

  • libsqlite3-de should be libsqlite3-dev – jnunn May 16 at 15:23
  • 1
    That's true. Thanks @jnunn! – Chris Dare May 23 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.