0

I have Project shell_script and structure tree of virtualenv is shell_script/ENV/bin/python3 What should look like shebang to this dir tree?

This is not working

#!/ENV/bin/env python3.6
wim
  • 266,989
  • 79
  • 484
  • 630
darek_82
  • 141
  • 2
  • 10
  • Possible duplicate of [Why do people write the #!/usr/bin/env python shebang on the first line of a Python script?](https://stackoverflow.com/questions/2429511/why-do-people-write-the-usr-bin-env-python-shebang-on-the-first-line-of-a-pyt) – eagle33322 Nov 18 '19 at 21:33

2 Answers2

1

Assuming you have your virtualenv activated, you can use

#!/usr/bin/env python3.x

and that will find the proper executable you are interested in.

eagle33322
  • 159
  • 1
  • 11
0

It should be like this:

#!/path/to/ENV/bin/python3

However, it's the installer which writes out the shebang for a script. You should not write it out manually. Whatever shebang you write manually in the source code will just get rewritten by the installer, when the package is installed.

Whichever Python executable was used by the installer will be hardcoded into the shebang, so if you pip install from within the virtualenv then the virtualev's path to Python executable will be used. If you pip install with system Python then the system executable will be used.

wim
  • 266,989
  • 79
  • 484
  • 630