Python3 shebang in conda windows

From raju

shebang in Python3 scripts under windows when using conda


A lot of python3 scripts expect an executable called python3. For example, they may have a shebang like

    #! /usr/bin/env python3

However, there is no such executable When using Anaconda in windows since the executable is simply called python instead of python3. Because of this, the scripts will fail with

    /usr/bin/env: ‘python3’: No such file or directory

Solution: Use this pass through script which calls python from the py36 environment.


  • Using Windows 7, Anaconda
  • The environment name, py36, is user specific. Change it accordingly.

tags | make shebangs in python3 scripts portable on windows