{"id":1910,"date":"2023-09-09T19:14:16","date_gmt":"2023-09-09T17:14:16","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=1910"},"modified":"2023-09-09T19:14:18","modified_gmt":"2023-09-09T17:14:18","slug":"python-software-unter-linux-aus-dem-python-package-index-installieren","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/09\/python-software-unter-linux-aus-dem-python-package-index-installieren\/","title":{"rendered":"Python-Software unter Linux aus dem Python Package Index installieren"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Python ist eine der beliebtesten Programmiersprachen unter Linux, wenn man wei\u00df wie ist es auch sehr einfach Python-Software ohne auf die Abh\u00e4ngigkeiten zu achten zu installieren. Welche Software es gibt, zeigt sich im&nbsp;<a href=\"https:\/\/pypi.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python Package Index<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Voraussetzungen schaffen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unter auf Debian basierenden Linux-Distributionen installieren Sie ganz einfach \u00fcber die Paket-Verwaltung das Paket &#8222;<strong>python3-pip<\/strong>&#8220; &#8211; diese Software dient zur Verwaltung der Python-Software, unter anderen Distributionen wird sich das Paket \u00e4hnlich nennen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Es ist eigentlich kaum n\u00f6tig Python-Software systemweit zu installieren, darum werde ich hier auch nur die Installation f\u00fcr den einfachen Nutzer beschreiben.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python-Software \u00fcber den Paket-Manager PIP installiert sich Benutzer-bezogen in sein Home-Verzeichnis in das versteckte Verzeichnis &#8222;<em>.local\/bin\/<\/em>&#8222;. Damit man nicht bei jedem Start einer solchen Software den Pfad angeben muss, f\u00fcgt man das Verzeichnis in in die ebenfalls im Home-Verzeichnis versteckt liegende Datei &#8222;<strong>.bashrc<\/strong>&#8220; ein. F\u00fcgen Sie also einfach folgende Zeile als neue Zeile in diese Datei ein und speichern die Datei, starten das Terminal neu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PATH=\"\/home\/USERNAME\/.local\/bin:\/usr\/local\/bin:\/usr\/bin:\/bin:\/usr\/local\/games:\/usr\/games\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Statt &#8222;<strong>USERNAME<\/strong>&#8220; geben Sie nat\u00fcrlich Ihren eigenen an. Dies gilt nat\u00fcrlich auch f\u00fcr die &#8222;<strong>.zshrc<\/strong>&#8220; wenn Sie die Zshell nutzen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Python-Software mittels PIP verwalten<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Wichtig &#8211; unter manchen Distributionen ersetzen Sie den Befehl &#8222;<strong>pip<\/strong>&#8220; durch &#8222;<strong>pip3<\/strong>&#8220; &#8211; einfach einmal am Terminal &#8222;<strong>pip<\/strong>&#8220; eingeben und zweimal die Taste\u00a0<strong><kbd>Tabulator<\/kbd><\/strong>\u00a0dr\u00fccken.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nehmen wir einfach einmal an Sie wollen das Paket &#8222;<strong>classifier<\/strong>&#8220; installieren:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install --user classifier<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip-1024x576.jpg\" alt=\"\" class=\"wp-image-1911\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">PIP k\u00fcmmert sich um alle Abh\u00e4ngigkeiten und installiert diese &#8211; einfach abwarten, hier wird nichts kompiliert, etc. &#8211; daher wird es auch nicht lange dauern.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mittels:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip list --user<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">l\u00e4sst sich schlie\u00dflich anzeigen welche Python-Pakete installiert sind:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1-1024x576.jpg\" alt=\"\" class=\"wp-image-1912\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/pip1.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Mit der Option &#8222;<strong><code>-U<\/code><\/strong>&#8220; l\u00e4sst sich ein installiertes Paket nun aktualisieren, die Software pr\u00fcft, ob es neue Versionen gibt &#8211; ist dies der Fall wird das Paket aktualisiert:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install --user -U classifier<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Alle installierten Python-Pakete werden mit folgendem Befehl aktualisiert:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip freeze --user | grep -v '^\\-e' | cut -d = -f 1  | xargs -n1 pip3 install --user -U  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Um ein Python-Paket zu deinstallieren gen\u00fcgt:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip uninstall classifier<\/code><\/pre>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"1910\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"1910\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Python ist eine der beliebtesten Programmiersprachen unter Linux, wenn man wei\u00df wie ist es auch sehr einfach Python-Software ohne auf die Abh\u00e4ngigkeiten zu achten zu installieren. Welche Software es gibt, zeigt sich im&nbsp;Python Package Index. Voraussetzungen schaffen Unter auf Debian basierenden Linux-Distributionen installieren Sie ganz einfach \u00fcber die Paket-Verwaltung das Paket &#8222;python3-pip&#8220; &#8211; diese Software [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1911,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[65],"class_list":["post-1910","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-verwalten","tag-software-verwalten"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=1910"}],"version-history":[{"count":1,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1910\/revisions"}],"predecessor-version":[{"id":1913,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1910\/revisions\/1913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/1911"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=1910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=1910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=1910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}