Reputation: 634
I'm making scripts/tools for colleagues that they can hopefully on their windows machines from a shared drive. Python versions and libraries are not consistent of course, and it's a mess to try do this. They just want it click run and it works, if they have to use the command line or pip, it just means they won't use the tool.
I started making my projects with virtual environments in Pycharm and that seems the way forward. But, I'm very new to them and I'm having trouble finding info about how to finalize the process. Maybe I'm using the wrong search keywords, I've been looking for a guide for this final step.
I was thinking I could copy venv folders over and make a batch file to run the local python.exe (run.bat file):
venv\Scripts\python.exe script.py
But then there are extra unneeded libraries. To make it lean do I uninstall them one by one? This accepted answer says not to copy and paste the venv over, which has me a little confused.
So I should freeze requirements.txt and then have my run.bat also install the libraries? This seems more messy to me.
What's the convention? And what's the best option for this situation?
Cheers.
Upvotes: 2
Views: 1300
Reputation: 708
You could package your tools with pyinstaller. It would require some extra work on your end, but you would end-up with a stand alone executable including the correct python interpreter and dependencies.
Upvotes: 2