Last active
April 24, 2025 12:10
-
-
Save alberic89/7b972597112478756a157f0ba329db6c to your computer and use it in GitHub Desktop.
Compile python libs in the env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -name "*.pyc" -delete && python3 -OO -m compileall . -j 0 && find . -path "*/__pycache__/*.pyc" -execdir sh -c "mv {} ../\$(basename {} | cut -d'.' -f1).pyc" \; && find -name "*.py" -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gain disk space by compiling your python libs.
It will:
.pyc
files.pyc
files with the optimisation level 2.pyc
files to allow python to find them.py
filesThe
.pyc
files are not portables between two different versions of Python or two machines.