Python Runtime Environments: Unterschied zwischen den Versionen
Matt (Diskussion | Beiträge) |
Matt (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 70: | Zeile 70: | ||
* yfinance.download seems not to work properly on Windows | * yfinance.download seems not to work properly on Windows | ||
== Operation System Independent == | |||
=== Jupyter Lab and Jupyter Notebook === | |||
See [[Jupyter Notebook]] | |||
[[Kategorie:Python]] | [[Kategorie:Python]] | ||
[[Kategorie:Terminal]] | [[Kategorie:Terminal]] | ||
Aktuelle Version vom 2. Oktober 2025, 12:19 Uhr
This article tries to bring structure into the different runtime environments for Python for running python programs or Jupyter Notebooks and their advantages and drawbacks.
This site is a major work in progress
Linux Environments
Debian Managed Packages
Try and find needed modules in the packages provided by Debian distribution:
apt-get install <package> # Install package aptitude # Interface for searching and installing available packages
PIP on Debian
Python runtime environment on debian is managed by Debian distribution. This means that you can not install additional packages with pip install <package>. If you try you get the following output:
matt@mypc:~$ pip install matplotlib
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
There are two options to proceed:
Virtual Environment (venv)
Install additional virtual environment as described in the message above, i.e.:
python3 -m venv ~/venv/finpy
Now either issue commands against that environments as follows:
~/venv/finpy/bin/python script1.py ~/venv/finpy/bin/pip install <package>
For further reading about pip see PIP Cheat Sheet
A more comfortable option is to switch to the environment sepcified by its path:
source ~/venv/finpy/bin/activate
Example:
matt@mypc:~$ source ~/venv/finpy/bin/activate (finpy) matt@mypc:~$
All subsequent commands will be executed in the context of the active environment, which is now listed in parentheses.
In order to leave the virtual environment again:
matt@mypc:~$ deactivate
PIP on Fedora
Install via:
sudo dnf install pip
Windows Environments
Windows Native
Miniconda
Further reading: Miniconda Cheat Sheet
For handling PIP within Miniconda see PIP Cheat Sheet
Known Issues
Not all packages seem to work properly. Known issues:
- yfinance.download seems not to work properly on Windows
Operation System Independent
Jupyter Lab and Jupyter Notebook
See Jupyter Notebook
