Inconsistent binary link creation when creating virtual environment with venv module

Coirier, Emmanuel Emmanuel.Coirier at caissedesdepots.fr
Thu Nov 21 11:41:29 EST 2019


Hello everyone,

I'm currently creating virtual environments with the venv module included in Python ("python -m venv <venv_name>"). I've noticed that the environment is not always consistent when using the same base interpreter with different names.

When I use the alias python3.n (python3.6 / python3.7 / python3.8) to create the environment like this example :

python3.7 -m venv venv37

The environment is created with 3 links to the python binary :

lrwxrwxrwx 1 root root    9 21 nov.  17:29 python -> python3.7
lrwxrwxrwx 1 root root    9 21 nov.  17:29 python3 -> python3.7
lrwxrwxrwx 1 root root   43 21 nov.  17:29 python3.7 -> /place/to/real/bin/python3.7

But when I use the bare python interpreter (python without version number in its name) like this :

python -m venv venv37

The environment is only created with 2 links to the python binary :

lrwxrwxrwx 1 root root   40 21 nov.  17:33 python -> /place/to/real/bin/python
lrwxrwxrwx 1 root root    6 21 nov.  17:33 python3 -> python

The python3.7 link is missing. This behavior is not observed with the pip installer which is always shipped in 3 flavors (pip, pip3, pip3.7)

Beside how this is coded, is there any functionnal reason to explain this behavior ? Shouldn't the 3 links be always created, regardless of which alias is used ?

Best regards,

--
Emmanuel Coirier
Informatique CDC


Interne
Ce message et toutes les pièces jointes (ci-après le «message») sont confidentiels et établis à l’intention exclusive de ses destinataires. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Si vous recevez ce message par erreur, merci de le détruire sans en conserver de copie et d’en avertir immédiatement l’expéditeur. Internet ne permettant pas de garantir l’intégrité de ce message, la Caisse des Dépôts et Consignations décline toute responsabilité au titre de ce message s’il a été modifié, altéré, déformé ou falsifié. Par ailleurs et malgré toutes les précautions prises pour éviter la présence de virus dans nos envois, nous vous recommandons de prendre, de votre côté, les mesures permettant d'assurer la non-introduction de virus dans votre système informatique. This email message and any attachments (“the email”) are confidential and intended only for the recipient(s) indicated. If you are not an intended recipient, please be advised that any use, dissemination, forwarding or copying of this email whatsoever is prohibited without prior written consent of Caisse des Depots et Consignations. If you have received this email in error, please delete it without saving a copy and notify the sender immediately. Internet emails are not necessarily secure, and Caisse des Depots et Consignations declines responsibility for any changes that may have been made to this email after it was sent. While we take all reasonable precautions to ensure that viruses are not transmitted via emails, we recommend that you take your own measures to prevent viruses from entering your computer system.


More information about the Python-list mailing list