- Web Development with Django Cookbook(Second Edition)
- Aidas Bendoraitis
- 176字
- 2021-07-23 14:32:00
Deleting Python-compiled files
When you run your project for the first time, Python compiles all your *.py
code in bytecode-compiled files, *.pyc
, which are used later for execution.
Normally, when you change the *.py
files, *.pyc
is recompiled; however, sometimes when switching branches or moving the directories, you need to clean up the compiled files manually.
Getting ready
Use your favorite editor and edit or create a .bash_profile
file in your home directory.
How to do it…
Add this alias at the end of .bash_profile
, as follows:
# ~/.bash_profile
alias delpyc="find . -name \"*.pyc\" -delete"
Now, to clean the Python-compiled files, go to your project directory and type the following command in the command line:
$ delpyc
How it works…
At first, we create a Unix alias that searches for the *.pyc
files and deletes them in the current directory and its children. The .bash_profile
file is executed when you start a new session in the command-line tool.
See also
- The Setting the Subversion ignore property recipe
- The Creating the Git ignore file recipe
- 大話PLC(輕松動(dòng)漫版)
- 深度實(shí)踐OpenStack:基于Python的OpenStack組件開(kāi)發(fā)
- FFmpeg入門(mén)詳解:音視頻原理及應(yīng)用
- OpenStack Orchestration
- Node.js Design Patterns
- 深入分布式緩存:從原理到實(shí)踐
- 青少年信息學(xué)競(jìng)賽
- 移動(dòng)互聯(lián)網(wǎng)軟件開(kāi)發(fā)實(shí)驗(yàn)指導(dǎo)
- Java 9 Programming By Example
- IoT Projects with Bluetooth Low Energy
- 現(xiàn)代C:概念剖析和編程實(shí)踐
- 玩轉(zhuǎn).NET Micro Framework移植:基于STM32F10x處理器
- 交互設(shè)計(jì)師成長(zhǎng)手冊(cè):從零開(kāi)始學(xué)交互
- PHP典型模塊與項(xiàng)目實(shí)戰(zhàn)大全
- Flink原理深入與編程實(shí)戰(zhàn):Scala+Java(微課視頻版)