遇到问题
pip 安装第三方库的时候报错ModuleNotFoundError: No module named '_ctypes'
File "/usr/local/python3/lib/python3.9/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
解决问题
主要原因是缺少libffi-devel
yum install libffi-devel -y
另外要注意setuptools版本过高可能会导致编译出现多个模块找不到的情况,比如版本如果是setuptools 60以上,则可以通过以下命令降级到低版本:
pip3 install --upgrade setuptools== 58.1.0
再重新编译python3即可成功
cd Python-3.9.12/
./configure --prefix=/usr/local/python3.9
make && make install
再重新执行pip3安装就不会报错了
- ModuleNotFoundError python3 python module ctypesmodulenotfounderror python3 python module modulenotfounderror encodings python module modulenotfounderror脚本python module modulenotfounderror经验python module modulenotfounderror python3 install python modulenotfounderror python module flask modulenotfounderror htmltestrunner python module modulenotfounderror python3 python crypto modulenotfounderror libffi-devel错误python3 python3 ubuntu python module