| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung |
| software:python [2021/09/15 09:20] – [venv] egmonts | software:python [2025/10/06 08:17] (aktuell) – [venv] egmonts |
|---|
| ====== Python ====== | ====== Python ====== |
| | ===== Sammlung ===== |
| | * https://anvil.works/ --> mit Python WebApps entwickeln |
| | * https://coverage.readthedocs.io/ CodeCoverage Messung |
| | * grafische Darstellung des Codes: https://bhavaniravi.com/blog/generate-uml-diagrams-from-python-code/ |
| | * QR Codes mit Logo https://python.plainenglish.io/using-python-to-create-a-qr-code-from-a-logo-caf5b631f83f |
| | * Bei Verwendung von ''from matplotlib import pyplot as plt '' kommt "//Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available. warnings.warn("Unable to import Axes3D. This may be due to multiple versions of//" |
| | * Lösung( https://stackoverflow.com/posts/52260859/) global und local installierte packages |
| | - ''sudo apt-get remove python3-matplotlib'' |
| | - ''pip install matplotlib'' |
| | |
| | |
| | |
| | |
| | |
| ===== venv ===== | ===== venv ===== |
| * ''.venv/bin/activate'' oder ''source venv/bin/activate'' | * ''.venv/bin/activate'' oder ''source venv/bin/activate'' |
| * pip freeze > requirements.txt #zeigt/speichert installierte Packages | * pip freeze > requirements.txt #zeigt/speichert installierte Packages |
| * refresh | * refresh |
| * nach https://bodo-schoenfeld.de/eine-virtuelle-umgebung-fuer-python-erstellen/ | * nach https://bodo-schoenfeld.de/eine-virtuelle-umgebung-fuer-python-erstellen/ bzw. https://realpython.com/python-virtual-environments-a-primer/ |
| * Vorbereiten, installieren: ''sudo pip3 install virtualenv'' | * Workflow: |
| * Umgebung im Projektordner erstellen: ''virtualenv venv'' | * Vorbereiten, installieren: ''sudo pip3 install virtualenv'' oder ''sudo apt install python3-venv'' |
| * aktivieren der Umgebung ''source venv/bin/activate'' | * Umgebung im Projektordner erstellen: ''virtualenv venv'' oder ''python3 -m venv ./venv'' |
| * arbeiten und ggf. Module installieren mit ''pip3'' | * Umgebung mit vorhendenen packages anlegen: ''python3 -m venv venv --system-site-packages'' |
| * anzeigen der module mit ''pip3 freeze'' | * Pip beim Anlegen aktualisieren: ''python3 -m venv venv --upgrade-deps'' |
| * deaktivieren: ''deactivate'' | * aktivieren der Umgebung ''source venv/bin/activate'' |
| | * arbeiten und ggf. Module installieren mit ''pip3'' bzw. ''python -m pip install <package-name>'' |
| | * anzeigen der module mit ''pip3 freeze > requirements.txt'' oder ''python -m pip freeze > requirements.txt'' und neu installieren: ''python -m pip install -r requirements.txt'' |
| | * das speichert aber nicht reproduzierbar die python version und packages version!, besser: siehe unten! |
| | * anzeigen welche Versionen von packages installiert sind: ''python3 -m pip list'' |
| | * deaktivieren: ''deactivate'' |
| | * Genaue, deterministische Reproduzierbarkeit von VENVs mittels ''pip-compile'' https://pip-tools.readthedocs.io/en/latest/#example-usage-for-pip-compile |
| | * in der aktiven Umgebung installieren: ''python -m pip install pip-tools'' |
| | * ''python -m pip freeze > requirements.in'' |
| | * ''pip-compile requirements.in'' |
| | * zum Installieren der Abhängigkeiten (in requrirements.txt): ''pip-sync'' |
| | |
| | ===== JuPyterlab ===== |
| | * Installation: ''pip3 install jupyterlab'' |
| | * Start: ''jupyter-lab'' |
| | * Plugins: |
| | * <del>[[https://rise.readthedocs.io/en/stable/|RISE]] - Als Präsendationsfolien darstellen: ''pip3 install RISE''</del> (Aktuell nur für das alte Notebook https://rise.readthedocs.io/en/stable/usage.html#jupyterlab https://github.com/damianavila/RISE/issues/270 ) |
| | * Viele Beispiel-Notepads: https://github.com/nsadawi?tab=repositories |
| | |
| | ===== KI/ML ===== |
| | * https://open.hpi.de/courses/kieinstieg2020 |
| | * https://open.hpi.de/courses/kipraxis2021/ |
| | * Buch https://raw.githubusercontent.com/abhishekkrthakur/approachingalmost/master/AAAMLP.pdf |
| |
| ===== OpenCV ===== | ===== OpenCV ===== |
| * Installation von https://black.readthedocs.io/en/latest/ | * Installation von https://black.readthedocs.io/en/latest/ |
| * ''pip install black'' | * ''pip install black'' |
| * ''black script.py'' oder über Kontext/Plugin in IDE | - ''black script.py'' Aufruf über Kommandozeile |
| | - oder über Kontext/Plugin in IDE pyCharm |
| | - externes Tool anlegen mit Pfad zu ''which black'', und in https://plugins.jetbrains.com/plugin/7177-file-watchers anlegen |
| | - oder in https://plugins.jetbrains.com/plugin/14321-blackconnect/ eintragen und mit Autostart starten |
| | * pip3 install aiohttp aiohttp_cors blackd |
| | * mit Plugin https://plugins.jetbrains.com/plugin/14321-blackconnect |
| | * blackd in autostart eintragen |
| | * Flussdiagramm aus Python machen, oder für einzelne Funktion: https://pypi.org/project/pyflowchart/ --> |
| | * ''pip install pyflowchart'' |
| | * ''python -m pyflowchart example.py'' oder ''python -m pyflowchart example.py -f main'' |
| * ToDo: | * ToDo: |
| * https://github.com/wemake-services/wemake-python-styleguide | * https://github.com/wemake-services/wemake-python-styleguide |