You should look at the shebang in /usr/bin/ansible, I'm guessing it doesn't
point to `/usr/local/bin/python2.7`

ansible_python_interpreter only affects module execution, not the python
interpreter the main ansible process uses.

Likely you should uninstall ansible, and install using that new python.
Maybe something like `/usr/local/bin/pip2.7 install ansible`

That is just an assumption, you'll need to fill in the blanks.

On Mon, Jan 29, 2018 at 2:41 PM, ZillaYT <[email protected]> wrote:

> I have
>
> $ which ansible
> /usr/bin/ansible
> user@hostname$ /usr/bin/ansible --version
> ansible 2.4.0.0
>   config file = /users/user/.ansible.cfg
>   configured module search path = [u'/users/user/.ansible/plugins/modules'
> , u'/usr/share/ansible/plugins/modules']
>   ansible python module location = /local/python/lib/python2.7/site-
> packages/ansible-2.4.0.0-py2.7.egg/ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.14 (default, Oct 10 2017, 13:19:29) [GCC 4.4.7
> 20120313 (Red Hat 4.4.7-17)]
>
>
> However, I want Ansible to use
>
> $ which python2.7
> /usr/local/bin/python2.7
> user@hostname$ python2.7 -V
> Python 2.7.14
>
> I have the following in my ansible.cfg file in my home dir
>
> ansible_python_interpreter = /usr/local/bin/python2.7
>
> What's even more confusing is when I run ansible-galaxy to say create a
> role, it tries to use python2.6 libs, and I get...
>
> $ ansible-galaxy init test-dict
> Traceback (most recent call last):
>   File "/usr/bin/ansible-galaxy", line 4, in <module>
>     __import__('pkg_resources').run_script('ansible==2.4.0',
> 'ansible-galaxy')
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 3037, in <module>
>     @_call_aside
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 3021, in _call_aside
>     f(*args, **kwargs)
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 3050, in _initialize_master_working_set
>     working_set = WorkingSet._build_master()
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 655, in _build_master
>     ws.require(__requires__)
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 969, in require
>     needed = self.resolve(parse_requirements(requirements))
>   File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line
> 855, in resolve
>     raise DistributionNotFound(req, requirers)
> pkg_resources.DistributionNotFound: The 'cryptography' distribution was
> not found and is required by ansible
>
>
> How can I straighten all this out so Ansible uses the
> /usr/local/*/python2.7 paths?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/adfce955-abda-4f37-b6a7-74cfa6e8a8fb%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/adfce955-abda-4f37-b6a7-74cfa6e8a8fb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v_1RU5mTonCgmzNhNAdT7zoQgFnZyY2zBoGABvXGVgutQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to