Python
Links
https://wiki.python.org/moin/BeginnersGuide/Programmers
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
Python IDE
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.
Visual Studio Code
https://code.visualstudio.com/docs/python/python-tutorial
Wichtig - du mußt VSC sagen welchen Interpreter er nutzen soll. Am besten
- über brew python installieren.
- Command Pallette ⇧⌘P, anfangen zu tippen um Python: Select Interpreter command zu finden, dann auswählen.
- Oder Python Environment option in der Statusbar wenn vorhanden. Evtl. wird auch schon einer angezeigt.
- VSC findet i.d.R. automatisch installierte Environments. Wenn nicht in Configuring Python environments suchen (siehe Link oben)
- When using an Anaconda distribution, the correct interpreter should have the suffix ('base':conda), for example Python 3.7.3 64-bit ('base':conda).
- Selecting an interpreter sets which interpreter will be used by the Python extension for that workspace.
- Note: If you select an interpreter without a workspace folder open, VS Code sets python.defaultInterpreterPath in User scope instead, which sets the default interpreter for VS Code in general. The user setting makes sure you always have a default interpreter for Python projects. The workspace settings lets you override the user setting.