ModuleNotFoundError:运行可播放的剧本时,看不到名为“ _curses”的模块错误。我需要点安装一些特定的模块吗?
File "/path/python/lib/python3.7/site-packages/ansible/plugins/action/pause.py", line 41, in <module>
import curses
File "/path/python/lib/python3.7/curses/__init__.py", line 13, in <module>
from _curses import *
另一个错误示例:
Python 3.7.0
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/python3/lib/python3.7/curses/__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
>>>
答案 0 :(得分:3)
看到此错误是因为在编译Python3源时系统中未安装curses。因此解决方法如下:
首先,安装curses :
sudo apt-get install libncurses-dev
sudo apt-get install libncursesw5-dev
(我没有注意libncursesw5-dev,如果libncurses-dev安装它可能是多余的)
然后,从源代码构建Python。
Python 3.7.0
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
现在没有错误,Ansible剧本开始运行!