10月 232019
 

centos 7 下使用pyenv 安装python 3.7时错误如下;

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

BUILD FAILED (CentOS Linux 7 using python-build 20180424)

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

Last 10 log lines:
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/main_parser.py”, line 12, in <module>
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/__init__.py”, line 6, in <module>
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/completion.py”, line 6, in <module>
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py”, line 20, in <module>
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py”, line 37, in <module>
File “/tmp/tmpgvoc4sao/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/utils/glibc.py”, line 3, in <module>
File “/tmp/python-build.20191023165632.13343/Python-3.7.4/Lib/ctypes/__init__.py”, line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named ‘_ctypes’
make: *** [install] Error 1

 

解决方法如下:

  1. 先安装: yum install libffi-devel -y
  2. 再安装python: pyenv install 3.7.4

DONE!

如果安装成功后有WARNING提示:

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?

为避免后续使用中问题,可进一步安装其它依赖包

yum install readline readline-devel readline-static -y

yum install sqlite-devel -y

yum install bzip2-devel bzip2-libs -y

yum install openssl openssl-devel openssl-static -y

OK!!

Sorry, the comment form is closed at this time.