Venv: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 50: | Zeile 50: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
pipenv run python train-MNIST.py | pipenv run python train-MNIST.py | ||
# oder | |||
pienv shell | |||
# oder | # oder | ||
source ~/.local/share/virtualenvs/mnist-UViGtUnG/bin/activate | source ~/.local/share/virtualenvs/mnist-UViGtUnG/bin/activate | ||
python3 train-MNIST.py | python3 train-MNIST.py | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Version vom 20. November 2024, 15:07 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
pienv shell
# oder
source ~/.local/share/virtualenvs/mnist-UViGtUnG/bin/activate
python3 train-MNIST.py