标签:backend 报错 为我 class manage python3 and 解决问题 http
由于每台机器的环境都不尽相同,存在某些机器的yum源太小或者所带软件版本太低或缺失等问题,所以在安装软件时也可能会产生不同的依赖报错。下面我就以安装ansible时自身遇到过的依赖问题解决方法作介绍,只介绍解决依赖部分内容,安装ansible详细过程另请自行百度。Ansible并未安装完成,存在依赖问题。
附报错内容:
ERROR! Unexpected Exception, this is probably a bug: (cryptography 1.3.1 (/usr/lib64/python2.7/site-packages), Requirement.parse(‘cryptography>=1.5‘))
the full traceback was:
Traceback (most recent call last):
File "/usr/bin/ansible", line 97, in <module>
mycli = getattr(import("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
File "/usr/lib/python2.7/site-packages/ansible/cli/init.py", line 38, in <module>
from ansible.inventory.manager import InventoryManager
File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 33, in <module>
from ansible.plugins.loader import inventory_loader
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 22, in <module>
from ansible.parsing.utils.yaml import from_yaml
File "/usr/lib/python2.7/site-packages/ansible/parsing/utils/yaml.py", line 17, in <module>
from ansible.parsing.yaml.loader import AnsibleLoader
File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/loader.py", line 30, in <module>
from ansible.parsing.yaml.constructor import AnsibleConstructor
File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/constructor.py", line 29, in <module>
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 here
VersionConflict: (cryptography 1.3.1 (/usr/lib64/python2.7/site-packages), Requirement.parse(‘cryptography>=1.5‘))
估计是cryptography该模块的问题(版本太低)。
安装cryptography前先安装setuptools
这里Setuptools版本需要大于等于18.5.
解压安装
#python setup.py build
#python setup.py install
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse(‘cffi!=1.11.3,>=1.8‘)
安装cffi
l python setup.py build
l python setup.py install
还是缺包
又报错(估计还是缺包)
该图片中报错关于Python.h的,并未找到相应的文件或目录,直接安装python3.4-devel,即可解决
yum install python-devel #因为我这ansible是用2版本的,所以后面装python-devel,python不带数字默认装2版本。
上传cryptography
解压安装
#python setup.py build
#python setup.py install
看到这里能够成功获取到ansible的版本信息则说明ansible已经安装成功了。
标签:backend 报错 为我 class manage python3 and 解决问题 http
原文地址:https://blog.51cto.com/14483703/2481634