- Glossary - decorator
Reference | First joined version | Python Enhancement Proposals |
---|---|---|
Function decorator | 2.4.1 | PEP 318 |
Class decorator | 2.6 | PEP 3129 |
Upgrade all outdated pip packages (homepage)
pip3 install pip-upgrade-outdated
pip_upgrade_outdated -3
Sync installed pip packages (doc)
# optional, in case "pip3" is still linked to the old version
brew unlink [email protected] && brew link [email protected]
pip3 freeze [--path /usr/local/lib/python3.8/site-packages] > requirements.txt
pip3 install -r requirements.txt
- Install
pyenv
itself:brew info pyenv
- Set PATH:
PATH=$(pyenv root)/shims:$PATH
(ref) - Install another version of Python:
[email protected] pyenv install 3.4.4
(ref) - Locally set Python version:
cd <path> && pyenv local 3.4.4
- Full list: https://docs.python.org/3/library/index.html
import subprocess
# run shell command `ls -l` and capture the output
result = subprocess.run(['ls', '-l'], capture_output=True)
result.stdout.decode('utf-8')
colorama
- Print colored terminal text.