[TriLUG] Python help?
Samir Faci via TriLUG
trilug at trilug.org
Tue Oct 15 17:26:44 EDT 2024
For python 3.x I've started using this instead.
python -m pip install <foobar>
It avoids the is pip linking to the same thing as the python binary etc. I
also second the #!/usr/bin/env python{2,3} it avoids weird BS behavior.
about the only thing you should directly reference in your #! is /bin/sh if
they move that around everything breaks. Like *cough* freebsd *cough* who
decided to put bash in /usr/local/bin/bash instead /usr/bin/bash like every
sane person.
That being said, python has WAY too many damn ways to create a virtualenv,
scope into it and break things. Good luck in your journey!
On Tue, Oct 15, 2024 at 10:41 AM Stephen Wiley via TriLUG <trilug at trilug.org>
wrote:
> I typically use the "env" binary in a shebang to run mine. If you write
> all your scripts that way it will just use the shell search path which
> the activate script should update so that your virtual environment bin
> folder is first and you/the user won't have to care.
>
> --Stephen
>
> On Tue, Oct 08, 2024 at 03:01:12PM -0500, Alan Porter via TriLUG wrote:
> >
> > The "python" executable inside the virtual environment has been altered
> to use a search path that only looks inside the venv. So this should be
> sufficient. I call python scripts inside venvs like this all the time.
> >
> > ~ alan
> >
> >
> >
> > > On Oct 8, 2024, at 2:16 PM, Cristóbal Palmer via TriLUG <
> trilug at trilug.org> wrote:
> > >
> > > On Tue, Oct 8, 2024, at 14:59, Brian McCullough via TriLUG wrote:
> > >>
> > >> venv/bin/python app.py
> > >
> > > This rings an alarm bell for me, because it is (depending on the
> context/environment) not sufficient to actually load the venv.
> > >
> > > In contexts where I call a python script that requires libs added via
> pip in a venv, I always have a shell wrapper that calls the ‘activate’
> script for the venv
> > >
> > > Warmly,
> > > CMP
> > > --
> > > This message was sent to: Alan Porter <porter at trilug.org>
> > > To unsubscribe, send a blank message to trilug-leave at trilug.org from
> that address.
> > > TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
> > > Unsubscribe or edit options on the web :
> https://www.trilug.org/mailman/options/trilug/porter%40trilug.org
> > > Welcome to TriLUG: https://trilug.org/welcome
> >
> > --
> > This message was sent to: Stephen Wiley <swiley at swiley.net>
> > To unsubscribe, send a blank message to trilug-leave at trilug.org from
> that address.
> > TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
> > Unsubscribe or edit options on the web :
> https://www.trilug.org/mailman/options/trilug/swiley%40swiley.net
> > Welcome to TriLUG: https://trilug.org/welcome
>
> --
> This message was sent to: Samir Faci <csgeek3674 at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web :
> https://www.trilug.org/mailman/options/trilug/csgeek3674%40gmail.com
> Welcome to TriLUG: https://trilug.org/welcome
More information about the TriLUG
mailing list