On 9/27/23 13:46, Larry Martell via Python-list wrote:
On Wed, Sep 27, 2023 at 12:42 PM Jon Ribbens via Python-list
<python-list@python.org> wrote:

On 2023-09-27, Larry Martell <larry.mart...@gmail.com> wrote:
I was under the impression that in a venv the python used would be in
the venv's bin dir. But in my venvs I see this in the bin dirs:

lrwxrwxrwx 1 larrymartell larrymartell    7 Sep 27 11:21 python -> python3
lrwxrwxrwx 1 larrymartell larrymartell   16 Sep 27 11:21 python3 ->
/usr/bin/python3
...
Not sure what this really means, nor how to get python to be in my venv.

WHy do you want python to be "in your venv"?

Isn't that the entire point of a venv? To have a completely self
contained env? So if someone messes with the system python it will not
break code running in the venv.

It can do that, it just turns out the defaults are to not make a dedicated Python instance, and to not give access to the system site packages. The venv and virtualenv modules, at least, will let you override either of those defaults via command-line options at creation time.

Once a year I have virtualenvs break when the new Python version appears in Fedora, which is irritating, but I take the attitude that virtualenvs are disposable and (try to) not let it bother me that I forgot to deal with that ahead of time. It helps if you make sure that a virtualenv has a record of its dependencies - perhaps a requirements.txt file in the project it's being used to build, so it's easy to recreate them.


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to