:: Re: [DNG] Python and Virtual Enviro…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Steve Litt
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] Python and Virtual Environments
Marc Shapiro via Dng said on Sun, 9 Feb 2025 21:01:52 -0800

>Is there any way to get pip to install to a system that does not use
>virtual environments, or any other way to install a module from PyPI
>to s non-venv environment?


I don't know your reason for not wanting to install a virtual python
environment. If your reason is that virtual python environments are a
poorly documented multistep pain in the ass that usually fails, I might
have good news for you.

A new Python installer called uv has emerged in the last few months,
and it's a whole new ballgame in virtual environments. Just put a few
meaningful Python comments at the top of your program, and uv installs
what you need in a virtual environment. The first time you run your
program it takes several seconds to a minute for uv to decide what all
you need in your particular OS and software environment. From then on,
uv adds between 1/2 second and a second to the start of your program.

https://treyhunner.com/2024/12/lazy-self-installing-python-scripts-with-uv/

Remember, the comments at the top are used by uv and must remain
comments. I refused to run Python virtual environments before learning
if uv. uv revolutionizes the lives of Python programmers.

And for gosh sakes don't use pip --break-system-packages

One time I CPAN installed a Perl package on a customer's Linux computer
and it broke his Vim. If the distro says to be careful, they mean it.

SteveT

Steve Litt

http://444domains.com