software:python
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
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/
- Bei Verwendung von
from matplotlib import pyplot as pltkommt „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-matplotlibpip install matplotlib
venv
.venv/bin/activateodersource venv/bin/activate- pip install …
- pip freeze > requirements.txt #zeigt/speichert installierte Packages
- refresh
- Workflow:
- Vorbereiten, installieren:
sudo pip3 install virtualenv - Umgebung im Projektordner erstellen:
virtualenv venvoderpython3 -m venv ./venv- Umgebung mit vorhendenen packages anlegen:
python3 -m venv venv –system-site-packages - Pip beim Anlegen aktualisieren:
python3 -m venv venv –upgrade-deps
- aktivieren der Umgebung
source venv/bin/activate - arbeiten und ggf. Module installieren mit
pip3bzw.python -m pip install <package-name> - anzeigen der module mit
pip3 freeze > requirements.txtoderpython -m pip freeze > requirements.txtund 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-compilehttps://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.inpip-compile requirements.in- zum Installieren der Abhängigkeiten (in requrirements.txt):
pip-sync
JuPyterlab
- Installation:
pip3 install jupyterlab - Start:
jupyter-lab - Plugins:
RISE - Als Präsendationsfolien darstellen:(Aktuell nur für das alte Notebook https://rise.readthedocs.io/en/stable/usage.html#jupyterlab https://github.com/damianavila/RISE/issues/270 )pip3 install RISE
- Viele Beispiel-Notepads: https://github.com/nsadawi?tab=repositories
KI/ML
OpenCV
- https://emanual.robotis.com/docs/en/platform/turtlebot3/appendix_raspi_cam/ Erkennung von OBjekt mit Position und Ausrichtung: https://youtu.be/AyZ5lcz5IzM?t=87
Nützliche Erweiterungen
- Parameter von der Kommandozeile einlesen
- Automatische Formatierung mit Black
- Installation von https://black.readthedocs.io/en/latest/
pip install blackblack script.pyAufruf ü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
- blackd in autostart eintragen
- Flussdiagramm aus Python machen, oder für einzelne Funktion: https://pypi.org/project/pyflowchart/ –>
pip install pyflowchartpython -m pyflowchart example.pyoderpython -m pyflowchart example.py -f main
- ToDo:
software/python.1735130816.txt.gz · Zuletzt geändert: von 127.0.0.1
