(Jan-01-2022, 09:10 AM)kucingkembar Wrote: he purpose is making GUI program using that install the missing "packages" in a new window,In general should make packages included when install with
lets said the user needs "packages" called NumPy that are not installed,
then the program will open a new cmd window showing the package being install,
instead "not responding" Tkinter window GUI
(usually, users will kill this process or think this program is not professional)
pip
.So then it's done in
setup.py
with install_requires
.Then all is done with
pip install my_pacakge
.There can be serval problems that can occurs if try to this for users after install.
Also should not use
os.system
(unsafe) as subprocces has taken over that task.Should capture output so know what going on,did it work(error message) or eg is is it already installed.
import subprocess output = subprocess.run('pip install numpy', capture_output=True, encoding='utf-8') print(output.stdout)
Output:Requirement already satisfied: numpy in c:\python39\lib\site-packages (1.20.2)