ich schreib zur Reproduktion mal den relevanten Code rein:
Code: Alles auswählen
sudo mkdir /opt/mcrit
sudo chown $USER:$USER /opt/mcrit
sudo apt install git python3-pip python3.8-venv -y
cd /opt
git clone https://github.com/danielplohmann/mcrit.git
cd mcrit
python3 -m venv env
source env/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install wheel
pip install -r requirements.txt
python3 -m pip install -e .
deactivate
Code: Alles auswählen
head /opt/mcrit/mcrit/Worker.py
--> #!/usr/bin/env python3
Erwartet (oder mir erhofft) hätte ich:
--> #!/opt/mcrit/env/bin/python3
Meine zwei Fragen dazu:
1. Ist es nicht so, dass eigentlich die Shebangs auf die venv gehardcoded werden (überschrieben werden) bei der pip Installation in eine venv? So verstehe ich das hier:
Quelle: https://docs.python.org/3/library/venv. ... venvs-workYou don’t specifically need to activate a virtual environment, as you can just specify the full path to that environment’s Python interpreter when invoking Python. Furthermore, all scripts installed in the environment should be runnable without activating it.
In order to achieve this, scripts installed into virtual environments have a “shebang” line which points to the environment’s Python interpreter, i.e. #!/<path-to-venv>/bin/python. This means that the script will run with that interpreter regardless of the value of PATH
Warum passiert das hier nicht? Ähnliches habe ich übrigens auch mit pip install git+https://...
Code: Alles auswählen
head /opt/mcrit/env/lib/python3.8/site-packages/mcrit/Worker.py