ModuleNotFoundError:运行ansible剧本时未看到名为“_curses”的模块错误。我需要通过pip安装某个特定的模块吗?
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'
>>>
发布于 2018-08-03 08:13:51
之所以会出现此错误,是因为编译Python3源代码时系统中未安装curses。因此,解决方案如下:
首先,安装curses
sudo apt-get install libncurses-dev
sudo apt-get install libncursesw5-dev
(我没有注意到libncursesw5-dev,如果libncurses-dev安装它,它可能是多余的)
然后,从源代码构建。
Python 3.7.0
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
现在没有错误,Ansible playbook运行!
https://stackoverflow.com/questions/51660821
复制相似问题