Skip to content

Commit

Permalink
Add example /usr/bin/env python as Python interpreter
Browse files Browse the repository at this point in the history
Sometime users will want to use the first Python interpreter available on PATH and/or can't know in advance the Python interpreter absolute path on managed hosts (such as NixOS where path might change in Nix store).

Method found from this comment: ansible/ansible#6345 (comment)
  • Loading branch information
PierreBeucher committed Aug 10, 2023
1 parent 254201f commit 133881b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/docsite/rst/reference_appendices/python_3_support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ Using Python 3 on the managed machines with commands and playbooks
$ ansible localhost-py3 -m ping
$ ansible-playbook sample-playbook.yml
* If you want to use the first Python found on ``PATH`` or Python interpreter path can't be known in advance, you can use ``/usr/bin/env python`` such as:

.. code-block:: shell
ansible_python_interpreter="/usr/bin/env python"
Note that you can also use the `-e` command line option to manually
set the python interpreter when you run a command. This can be useful if you want to test whether
Expand Down

0 comments on commit 133881b

Please sign in to comment.