Can I run the python interpreter without generating the compiled .pyc files?
From "What’s New in Python 2.6 - Interpreter Changes":
Python can now be prevented from writing .pyc or .pyo files by supplying the -B switch to the Python interpreter, or by setting the PYTHONDONTWRITEBYTECODE environment variable before running the interpreter. This setting is available to Python programs as the
sys.dont_write_bytecode
variable, and Python code can change the value to modify the interpreter’s behaviour.
Update 2010-11-27: Python 3.2 addresses the issue of cluttering source folders with .pyc
files by introducing a special __pycache__
subfolder, see What's New in Python 3.2 - PYC Repository Directories.
PYTHONDONTWRITEBYTECODE=1
can be bad for python performance (for python2 see https://www.python.org/dev/peps/pep-0304/ and for python3 see https://www.python.org/dev/peps/pep-3147/ ).import sys sys.dont_write_bytecode = True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With