LMSouq
general-dev Open

How to automatically install required packages from a Python script as necessary?

DE
Deepak
1 month ago
3 views
Problem Description
Is there anything in Python or Linux what basically instructs the system to "install whatever is necessary". Basically I find it annoying to install python packages for each new script/system/server that I work on. Each time I end up doing a `sudo pip` or an `apt-get` or `dnf` anyway. Why not automate that within the script itself. Wherever a 'no package found' error crops up, pass the library name to the install statement. Is this there ? PS: I know docker exists, but am talking at a Python/script level or a direct system level for purely execution purposes.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base