How could I make a script that would install modules but silently? I’ve tried the
.pyw method, but it doesn’t work when installing modules.
Here’s what I’ve have:
import os os.system("pip install module1") os.system("pip install module2") os.system("pip install module3")
Here we have to consider which output you trying to hide: stdout, stderr
The following code will hide stdout but will still show stderr.
import subprocess batcmd = "pip install numpy" result = subprocess.check_output(batcmd, shell=True) >>> result b'Requirement already satisfied: numpy in c:\users\xxxx\appdata\roaming\python\python38\site-packages (1.20.2)rn'
The following will hide all output:
pip install numpy 1,2>nul