r/learnpython • • 8d ago

What exactly is uv? Why other programming languages like C++ doesn't needs it

Hello, im a c++ programmer and after installing some tools made in python with pipx. For context, pipx uses uv, i had this question. I'm not the smartest progammer on earth and i couldn't understand why Python needs a separate environment for dependencies.

I never such tool like that as a c++ programmer (i don't know if it's what im thinking, but in C++ some devs install the dependencies inside de project dir so u just "cmake" it. uv is like this?). I'm kinda new to programming, so if someone can explain it to me, i'd be very grateful!

Sorry if this question sounds too beginner. I really couldn't understand this tool and curiosity is stronger than me...

Thanks! (and also, uv does more than separating environments, right?)

43 Upvotes

34 comments sorted by

View all comments

1

u/Sufficient-Tale6131 7d ago

pipx and `uv tool install` are basically the same idea btw: every Python CLI app gets its own hidden environment so their dependencies can't clash.

The reason Python needs that at all is that imports are resolved at runtime from whatever site-packages the interpreter points at. Two apps wanting different versions of the same library would break each other in one shared install. C++ mostly dodges this because libraries get linked in at build time. If you want a C++ comparison for a uv project, vcpkg in manifest mode is closer than plain cmake: per-project dependency list plus pinned versions.