ansible自动化运维 cryptography 0.8.2 版本兼容性报错解决办法

xiaoxiao2021-02-28  25

在管理端向客户机执行 ansible Client -m ping 时报错:ERROR! Unexpected Exception, this is probably a bug: VersionConflict: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse('cryptography>=1.1'))    from ansible.parsing.vault import VaultLib  File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 45, in <module>    from cryptography.hazmat.backends import default_backend  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>    import pkg_resources  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3011, in <module>    parse_requirements(__requires__), Environment()  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 630, in resolve    raise VersionConflict(dist,req) # XXX put more info hereVersionConflict: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse('cryptography>=1.1'))分析原因 :cryptography版本过低解决方法:cryptography需要通过pip安装,所以需要先安装pip

1.安装pip

https://pypi.org/project/pip/#files

下载pip-10.0.1.tar.gz

tar -zxvf pip-10.0.1.tar.gz

cd pip-10.0.1

python setup.py install

2.安装wheel

https://pypi.org/project/wheel/#files

下载wheel-0.31.1.tar.gz

tar -zxvf wheel-0.31.1.tar.gz

cd wheel-0.31.1

python setup.py install

做完这一步后,可以进行pip安装了。

3.安装cryptography 2.2.2

https://pypi.org/project/cryptography/

下载cryptography-2.2.2-cp27-cp27mu-manylinux1_x86_64.whl

pip install cryptography-2.2.2-cp27-cp27mu-manylinux1_x86_64.whl

等待安装完成,再次执行ansible Client -m ping 

[root@localhost 0]# ansible Client -m ping Enter passphrase for key '/root/.ssh/id_rsa': 192.168.60.194 | SUCCESS => {    "changed": false,     "ping": "pong"}[root@localhost 0]# 

问题解决。

转载请注明原文地址: https://www.6miu.com/read-2399962.html

最新回复(0)