ansible错误ImportError: No module named ansible.runner记录
按着官网提供的安装ansible
To configure the PPA on your machine and install ansible run these commands: $ sudo apt update $ sudo apt install software-properties-common $ sudo apt-add-repository --yes --update ppa:ansible/ansible $ sudo apt install ansible
当在服务器上查询ansible版本的时,出现下面错误
[root@hz-d-crm ~]# ansible -v Traceback (most recent call last): File "/usr/bin/ansible", line 36, in <module> from ansible.runner import Runner ImportError: No module named ansible.runner
解决方法:卸载重新安装
1、卸载
apt remove ansible
2、pip安装
[root@hz-d-crm ~]# pip install ansible Collecting ansible Downloading ansible-1.9.4.tar.gz (937kB) 100% |████████████████████████████████| 937kB 100kB/s Collecting paramiko (from ansible) Downloading paramiko-1.15.3-py2.py3-none-any.whl (166kB) 100% |████████████████████████████████| 167kB 136kB/s Collecting jinja2 (from ansible) Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB) 100% |████████████████████████████████| 266kB 1.4MB/s Collecting PyYAML (from ansible) Downloading PyYAML-3.11.tar.gz (248kB) 100% |████████████████████████████████| 249kB 72kB/s Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/python27/lib/python2.7/site-packages/setuptools-18.4-py2.7.egg (from ansible) Collecting pycrypto>=2.6 (from ansible) Downloading pycrypto-2.6.1.tar.gz (446kB) 100% |████████████████████████████████| 446kB 117kB/s Collecting ecdsa>=0.11 (from paramiko->ansible) Downloading ecdsa-0.13-py2.py3-none-any.whl (86kB) 100% |████████████████████████████████| 90kB 141kB/s Collecting MarkupSafe (from jinja2->ansible) Downloading MarkupSafe-0.23.tar.gz Installing collected packages: ecdsa, pycrypto, paramiko, MarkupSafe, jinja2, PyYAML, ansible Running setup.py install for pycrypto Running setup.py install for MarkupSafe Running setup.py install for PyYAML Running setup.py install for ansible Successfully installed MarkupSafe-0.23 PyYAML-3.11 ansible-1.9.4 ecdsa-0.13 jinja2-2.8 paramiko-1.15.3 pycrypto-2.6.1
您的资助是我最大的动力!
金额随意,欢迎来赏!