原始文件名为view.py、forms.py,但python自动添加/保存了一些名为view.pyc、forms.pyc的文件
我想删除那些多余的 view.pyc 和 forms.pyc 文件。
为什么我会得到那些 .pyc 文件?
或者我如何告诉 python 不要创建那些扩展名为 .pyc 的额外文件?
请您参考如下方法:
pyc文件是编译后的字节码文件,不是备份文件
6.1.2“编译”Python 文件 http://docs.python.org/release/1.5.1p1/tut/node43.html
As an important speed-up of the start-up time for short programs that use a lot of standard modules, if a file called "spam.pyc" exists in the directory where "spam.py" is found, this is assumed to contain an already-``byte-compiled'' version of the module spam. The modification time of the version of "spam.py" used to create "spam.pyc" is recorded in "spam.pyc", and the file is ignored if these don't match.
更新:
避免编写 pyc 文件(Python 2.6+)
- 以 -B 标志开始(
python -B) - 设置 PYTHONDONTWRITEBYTECODE 环境变量。
Vim 备份命名为 view.py~
禁用 vim 备份使用
:se nobackup
