4 ms·
This post points out one of my struggles with python. I am not a python developer but I use python heavily for some tooling. So all I need to do is to “distrib
by 404mm 4y ago
This post points out one of my struggles with python.
I am not a python developer but I use python heavily for some tooling. So all I need to do is to “distribute” my tools to other servers in a replicable and consistent matter, isolated from global packages.
Can you please help me understand two points?
1. If I use venv+pip to install some python app, do I have to “activate” that specific virtual environment before executing that tool or can I just simply call it by its path on the file system?
2. Are there any official guide rails for making venv-wrapped app accessible to other users on a server? Or just as simple as placing links to /usr/local/bin/ for example?
- Groxx 4y ago1: usually you can just run the binary by its path. tbh I don't fully understand why it doesn't always work, but it's fairly rare, and most of the ones I can kinda-remember may have been during install time. 2: due to 1, symlinks often work. It's how I've installed all of my custom python binaries. Otherwise you'll very frequently see python "binaries" installed by e.g. Homebrew that are actually ~5 lines of minor environment prep and then running the actual binary - that's the only reliable way afaik. Bonus answer to 2: pipx looks pretty decent.
- 404mm 4y agoThanks! I’ll check out pipx!
- okasaki 4y ago1. You can call it directly by referencing the venv python exe eg /pqth/to/your/venv/bin/python /path/to/your/script.py
- 404mm 4y agoNice, I think this is what I was looking for!