# Using python2 instead of python in shebang lines

**URL:** <https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586>\
**Category:** Ansible Developer\
**Tags:** fedora\
**Created:** [October 22, 2014, 11:07pm UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586 "2014-10-22T23:07:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maykel\_Moya](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Maykel\_Moya](https://forum.ansible.com/u/Maykel_Moya)\
**Post date:** [October 22, 2014, 11:07pm UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586/1 "2014-10-22T23:07:33Z")

</div>

Hi

Given that the requirement for the management host is py2.6+ and  
PEP394[1] has been around some time now, would you consider using  
'#!/usr/bin/env python2' instead of '#!/usr/bin/env python' in bin/\*? I  
can submit a PR for this.

Also see this Fedora ticket[2]

Cheers,  
maykel

[1] [http://legacy.python.org/dev/peps/pep-0394/](http://legacy.python.org/dev/peps/pep-0394/)  
[2] [https://fedorahosted.org/fpc/ticket/327](https://fedorahosted.org/fpc/ticket/327)

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 22, 2014, 11:29pm UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586/2 "2014-10-22T23:29:04Z")

</div>

Doing this would break ansible on Mac, as Mac does not ship a python2 symlink/binary. I’m sure there are other OSes that it would cause issue with as well.

Ideally, if ansible eventually migrates to setuptools entrypoints, this would be solved without having to worry about system specific paths.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 25, 2014, 12:11am UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586/3 "2014-10-25T00:11:47Z")

</div>

“Ideally, if ansible eventually migrates to setuptools entrypoints”

Can you share more specifics?

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [October 25, 2014, 6:10am UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586/4 "2014-10-25T06:10:26Z")

</div>

It's basically the changes from this PR:  
[https://github.com/ansible/ansible/pull/9401](https://github.com/ansible/ansible/pull/9401)

Not quite sure if/how it would affect other distro-specific packaging.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 25, 2014, 10:46pm UTC](https://forum.ansible.com/t/using-python2-instead-of-python-in-shebang-lines/16586/5 "2014-10-25T22:46:01Z")

</div>

I’m open to this, but we should just start it in the v2 subtree.

We’ll make a note to experiment later.
