ansible部署TIDB,python2.7安装ansible失败

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:

  • 【问题描述】:前两天部署还没问题。今天部署,发现python安装ansible失败。报错信息如下: Traceback (most recent call last): File “”, line 1, in File “/tmp/pip-build-0QnDEA/ansible/setup.py”, line 315, in main() File “/tmp/pip-build-0QnDEA/ansible/setup.py”, line 310, in main setup(**setup_params) File “/usr/lib64/python2.7/distutils/core.py”, line 112, in setup _setup_distribution = dist = klass(attrs) File “/usr/lib/python2.7/site-packages/setuptools/dist.py”, line 269, in init _Distribution.init(self,attrs) File “/usr/lib64/python2.7/distutils/dist.py”, line 287, in init self.finalize_options() File “/usr/lib/python2.7/site-packages/setuptools/dist.py”, line 302, in finalize_options ep.load()(self, ep.name, value) File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 2341, in load return self.resolve() File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 2351, in resolve raise ImportError(str(exc)) ImportError: ‘module’ object has no attribute ‘check_specifier’


Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-0QnDEA/ansible/

各种版本: python:2.7.5 pip:8.1.2 centos:7.6

升级pip版本到20.0.2,然后安装ansible,报错: ERROR: Command errored out with exit status 1: command: /usr/bin/python2 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-bNhOPw/ansible/setup.py’"’"’; file=’"’"’/tmp/pip-install-bNhOPw/ansible/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base /tmp/pip-install-bNhOPw/ansible/pip-egg-info cwd: /tmp/pip-install-bNhOPw/ansible/ Complete output (19 lines): Traceback (most recent call last): File “”, line 1, in File “/tmp/pip-install-bNhOPw/ansible/setup.py”, line 315, in main() File “/tmp/pip-install-bNhOPw/ansible/setup.py”, line 310, in main setup(**setup_params) File “/usr/lib64/python2.7/distutils/core.py”, line 112, in setup _setup_distribution = dist = klass(attrs) File “/usr/lib/python2.7/site-packages/setuptools/dist.py”, line 269, in init _Distribution.init(self,attrs) File “/usr/lib64/python2.7/distutils/dist.py”, line 287, in init self.finalize_options() File “/usr/lib/python2.7/site-packages/setuptools/dist.py”, line 302, in finalize_options ep.load()(self, ep.name, value) File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 2341, in load return self.resolve() File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 2351, in resolve raise ImportError(str(exc)) ImportError: ‘module’ object has no attribute ‘check_specifier’ ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

很神奇的问题,直接用命令:pip install ansible==2.7.11安装,也会报错。

可以确认一下 pip 命令的版本 可以尝试一下升级更新 pip 后再使用 pip install 安装

试过了~从pip8,升级pip9,最后直接最新版pip20,都是一样的错误

最终解决方案: sudo pip install --upgrade setuptools==44.0.0

:+1::+1::+1: