Alex Rivera | Logout

How to avoid creation of .pyc files on OS X 10.8 with Python 2.7?

Asked 2012-11-29T14:13:51.003
10

It seems that on OS X 10.8 (with Python 2.7) the .pyc files are created even if you setup the environment variable PYTHONDONTWRITEBYTECODE=1

How can I prevent this from happening, or how can I convince Python not to create this files in the same location as the source files.

Edit
Report

1 Answer

1

I would suggest this at the top of your python script:

#!/usr/bin/env python -B

Or, use the sys.dont_write_bytecode method.

See also: How to avoid .pyc files? which suggests a few other solutions, including one method that works in pre-2.6 python.

answered 2012-12-18T11:53:12.390

Your Answer