python
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| python [2024-07-28 09:30:39] – [allgemeines] david | python [2024-07-28 10:02:24] (aktuell) – [venv] david | ||
|---|---|---|---|
| Zeile 13: | Zeile 13: | ||
| * es wird stark empfohlen, venv in python zu nutzen | * es wird stark empfohlen, venv in python zu nutzen | ||
| * um pakete mit pip global zu installieren ist venv jedoch unpraktisch, | * um pakete mit pip global zu installieren ist venv jedoch unpraktisch, | ||
| - | * pipx install: pakete installieren | + | * '' |
| - | * pip install (in einem aktiven | + | * '' |
| - | * pip install (ohne venv): vermeiden wenn möglich | + | * '' |
| relevante python pakete in debian | relevante python pakete in debian | ||
| + | |||
| <code bash> | <code bash> | ||
| sudo apt install python-is-python3 python3 python3-pip python3-venv pipx | sudo apt install python-is-python3 python3 python3-pip python3-venv pipx | ||
| Zeile 24: | Zeile 25: | ||
| paket mit pipx installieren | paket mit pipx installieren | ||
| (black ist übrigens ein super python formatter, es ist sowas wie das gofmt von python) | (black ist übrigens ein super python formatter, es ist sowas wie das gofmt von python) | ||
| + | |||
| <code bash> | <code bash> | ||
| pipx install black | pipx install black | ||
| Zeile 29: | Zeile 31: | ||
| venv erstellen | venv erstellen | ||
| + | |||
| <code bash> | <code bash> | ||
| mkdir / | mkdir / | ||
| Zeile 35: | Zeile 38: | ||
| type python | type python | ||
| - | python -m venv venv | + | python -m venv .venv |
| - | . venv/ | + | . .venv/ |
| type python | type python | ||
| Zeile 47: | Zeile 50: | ||
| type python | type python | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== best practices ===== | ||
| + | |||
| + | sicherstellen, | ||
| + | |||
| + | <code python main.py> | ||
| + | # | ||
| + | |||
| + | def main(): | ||
| + | print(" | ||
| + | |||
| + | if __name__ == " | ||
| + | main() | ||
| </ | </ | ||
/home/http/wiki/data/attic/python.1722159039.txt · Zuletzt geändert: von david
