Venv: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 47: | Zeile 47: | ||
python_version = "3.11" | python_version = "3.11" | ||
</pre> | </pre> | ||
== Starten == | |||
<syntaxhighlight lang="bash"> | |||
pipenv run python train-MNIST.py | |||
# oder | |||
source ~/.local/share/virtualenvs/mnist-UViGtUnG/bin/activate | |||
python3 train-MNIST.py | |||
</syntaxhighlight> | |||
Version vom 20. November 2024, 14:12 Uhr
Links
Zielsetzung
VENV ist ein Python-Paket, das eine indiviuelle Python-Umgebung für ein Projekt ermöglicht.
Installation
apt install python3-venv
Umgebung einrichten
# Erzeugen eines Ordners local:
python3 -m venv env
# Aktivieren: Einlesen der Konfiguration mittels "source":
. env/bin/activate
# Am Ende:
. env/bin/deactivate
Es erschient ein anderer Prompt.
Starten von python3 pip3...: env/bin/python3 env/bin/pip3
Automatische Konfiguration mit pipenv
- Pipfile:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "https://download.pytorch.org/whl/cpu/"
verify_ssl = false
name = "pytorch"
[packages]
torch = {version="*"}
torchvision = {version="*"}
torchaudio = {version="*"}
numpy = {version="*"}
wandb = {version="*"}
[dev-packages]
[requires]
python_version = "3.11"
Starten
pipenv run python train-MNIST.py
# oder
source ~/.local/share/virtualenvs/mnist-UViGtUnG/bin/activate
python3 train-MNIST.py