Python: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
Zeile 121: Zeile 121:
 
  pip --version  
 
  pip --version  
 
This should give pip is not recognized as an internal or external command
 
This should give pip is not recognized as an internal or external command
 +
 +
== Anaconda ==
 +
Wahrscheinlich der einfachste Einstieg in die Python Welt. Man kann schnell auf alle Möglichen Tools zugreifen, es lassen sich verschiedenen Versionen gleichzeitig nutzen / zusammenstellen. Hat Spyder dabei - eine recht geschickte IDE zur Python-Entwicklung.
 +
 +
Hat auch viele wichtige Libs bereits an Bord.

Version vom 29. Januar 2021, 09:45 Uhr

Python auf dem Mac

Ist standardmäßig installiert.

Aufruf von Programmen mit

python programmname

Im entsprechenden Verzeichnis im Terminal

Python Konsole bekommt man vom Terminal mit aufruf des Programms.

idle.app

Zusätzlich gibt es noch Python Launcher für verschiedene Python Versionen -> noch nicht getestet.

Python & Homebrew

Hinweis

Generell scheinen die Dinge besser zu funktionieren wenn man sie alle über Homebrew installiert. Also:

brew install python
brew install pyqt

python

brew install python

Installiert eine neuere Version. Es gibt ein paar Infos zur Installation aus:

Zu SSL

A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

Zu sqlite

sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have sqlite first in your PATH, run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"


Zu tcs-ck

tcl-tk is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have tcl-tk first in your PATH, run:
  echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc

For compilers to find tcl-tk you may need to set:
  export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
  export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"

Zu Python

Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

PIP

Mit Homebrew

Wenn man aktuelle Pythons mit Homebrew installiert wird pip mitinstalliert. Bei Catalina sind sie dann mit

python3

und

pip3

ansprechbar

Probleme bei normaler installation

Beliebter Paketmanager für Python. Sollte eigentlich mit

sudo easy_install pip

Installierbar sein. Gibt bei mir Versions Probleme.

Deinstallieren:


There is no completely automatic uninstall but you can do it in two steps:

easy_install -m pip

This should remove pip from easy-install.pth and print the full path to where pip is installed. Now just manually remove the path that the previous command printed. Or you could just manually edit easy-install.pth and remove the pip sources if you know where they are located. Run command prompt as administrator Give the command

easy_install -m pip

This may not uninstall pip completely. So again give this command

pip uninstall pip 

If by previous command pip got uninstalled then this command wont run, else it will completely remove pip Now check by giving command

pip --version 

This should give pip is not recognized as an internal or external command

Anaconda

Wahrscheinlich der einfachste Einstieg in die Python Welt. Man kann schnell auf alle Möglichen Tools zugreifen, es lassen sich verschiedenen Versionen gleichzeitig nutzen / zusammenstellen. Hat Spyder dabei - eine recht geschickte IDE zur Python-Entwicklung.

Hat auch viele wichtige Libs bereits an Bord.