ModuleNotFoundError: No module named '_ctypes' solutions
1 Introduction
Tencent cloud pip install sklearn Times this error, as follows:
File "/usr/local/python3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
The reason: Python3 There is a built-in module called ctypes, it is Python3 external library module that provides compatible C language data types, and through it calls the shared library under Linux (Shared library), this module requires CentOS7 system external function library (Foreign function library) development-link library (header files and libraries).
Since the system is not installed in CentOS7 external libraries (libffi) development libraries package, so when you install pip on the reported "ModuleNotFoundError: No module named '_ctypes '" error.
2 step
Mounting an external function library (libffi)
yum install libffi-devel -y
Reinstall python
yum install python
With the package installation requires pip3 Install
pip3 install sklearn
3 References
Python3.7.0 or later installed pip error ModuleNotFoundError: No module named '_ctypes' solution