I tried to install ansible 2.5.9 on debian9
os:python-2.7
install steps:
1. wget https://releases.ansible.com/ansible/ansible-2.5.9.tar.gz
2. tar zxvf ansible-2.5.9.tar.gz
3. cd ansible-2.5.9.tar.gz
4. python setup.py build
5. python setup.py install
it find Best match: Jinja2 3.0.0a1, which need python3. I just need Jinja2 2.8.0. How to solve this problem?
=================================================================
Installed /usr/local/lib/python2.7/dist-packages/paramiko-2.7.1-py2.7.egg
Searching for jinja2
Reading https://pypi.python.org/simple/jinja2/
Downloading https://files.pythonhosted.org/packages/36/cc/5cd404a00f1b93bc830505c7a78553d9f49f7152c336466fc206790cc26c/Jinja2-3.0.0a1.tar.gz#sha256=c922560ac46888d47384de1dbdc3daaa2ea993af4b26a436dec31fa2c19ec668
Best match: Jinja2 3.0.0a1
Processing Jinja2-3.0.0a1.tar.gz
Writing /tmp/easy_install-3fa9kr/Jinja2-3.0.0a1/setup.cfg
Running Jinja2-3.0.0a1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3fa9kr/Jinja2-3.0.0a1/egg-dist-tmp-SDCN31
Traceback (most recent call last):
TypeError: 'encoding' is an invalid keyword argument for this function
=======================================================================
Installed /usr/local/lib/python2.7/dist-packages/paramiko-2.7.1-py2.7.egg
Searching for jinja2
Reading https://pypi.python.org/simple/jinja2/
Downloading https://files.pythonhosted.org/packages/36/cc/5cd404a00f1b93bc830505c7a78553d9f49f7152c336466fc206790cc26c/Jinja2-3.0.0a1.tar.gz#sha256=c922560ac46888d47384de1dbdc3daaa2ea993af4b26a436dec31fa2c19ec668
Best match: Jinja2 3.0.0a1
Processing Jinja2-3.0.0a1.tar.gz
Writing /tmp/easy_install-3fa9kr/Jinja2-3.0.0a1/setup.cfg
Running Jinja2-3.0.0a1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3fa9kr/Jinja2-3.0.0a1/egg-dist-tmp-SDCN31
Traceback (most recent call last):
File “setup.py”, line 312, in
main()
File “setup.py”, line 307, in main
setup(**setup_params)
File “/usr/lib/python2.7/distutils/core.py”, line 151, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/lib/python2.7/dist-packages/setuptools/command/install.py”, line 67, in run
self.do_egg_install()
File “/usr/lib/python2.7/dist-packages/setuptools/command/install.py”, line 117, in do_egg_install
cmd.run()
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 436, in run
self.easy_install(spec, not self.no_deps)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 680, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 727, in install_item
self.process_distribution(spec, dist, deps)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 772, in process_distribution
[requirement], self.local_index, self.easy_install
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 1118, in best_match
return self.obtain(req, installer)
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 1130, in obtain
return installer(requirement)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 699, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 725, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 906, in install_eggs
return self.build_and_install(setup_script, setup_base)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 1145, in build_and_install
self.run_setup(setup_script, setup_base, args)
File “/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py”, line 1131, in run_setup
run_setup(setup_script, args)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 258, in run_setup
raise
File “/usr/lib/python2.7/contextlib.py”, line 35, in exit
self.gen.throw(type, value, traceback)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 198, in setup_context
yield
File “/usr/lib/python2.7/contextlib.py”, line 35, in exit
self.gen.throw(type, value, traceback)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 169, in save_modules
saved_exc.resume()
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 144, in resume
six.reraise(type, exc, self._tb)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 157, in save_modules
yield saved
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 198, in setup_context
yield
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 285, in run
return func()
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 253, in runner
_execfile(setup_script, ns)
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 47, in _execfile
exec(code, globals, locals)
File “/tmp/easy_install-3fa9kr/Jinja2-3.0.0a1/setup.py”, line 6, in
import os.path
File “/usr/lib/python2.7/dist-packages/setuptools/sandbox.py”, line 421, in _open
return _open(path, mode, *args, **kw)
TypeError: ‘encoding’ is an invalid keyword argument for this function
root@pubt1-curve2:~/ansible-2.5.9# exit
exit
shell returned 1
Press ENTER or type command to continue
在 2020年4月15日星期三 UTC+8下午5:25:46,Xiaocui Li写道:
Hi
Use python3 instead of python2.
On a related note - what is the reason for installing an unmaintained
and EOL version of ansible?