Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Python from generating pyc files in shebang [duplicate]

Is there a way to stop python from creating .pyc files, already in the shebang (or magic number if you will) of the Python script?

Not working:

#!/usr/bin/env python -B
like image 838
Prof. Falken Avatar asked Nov 14 '12 09:11

Prof. Falken


1 Answers

it is possible by putting your python interperter path directly in the she bang instead of using env.

#!/usr/bin/python -B

of course this means you lose out on some of the portability benefits of using env. There is a discussion of this issue with env on the wikipedia Shebang page. They use python as one of their env examples.

like image 105
Marwan Alsabbagh Avatar answered Sep 18 '22 11:09

Marwan Alsabbagh