How to run cmd codes like pip install matplotlib
in python?
I tried to use Stash
, but it costs too much time and it cannot be run if I have a UIView
. So, can someone help me?
Asked
Active
Viewed 48 times
-3

Doggy
- 35
- 9
-
2Duplicate of [How do I execute a program or call a system command?](https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command) – esqew Sep 18 '22 at 01:15
-
Subprocess is not suitable for me. – Doggy Sep 18 '22 at 01:26
-
2@Doggy - subprocess likely _is_suitable. You've found `os.system` which generally works also, so maybe no big deal. But everything os.system can do, subprocess can do. – tdelaney Sep 18 '22 at 01:30
-
Yea, but my python shell doesn’t have subprocess module (I don’t know why ) – Doggy Sep 18 '22 at 01:33
-
But I have “os” module, and I have that module – Doggy Sep 18 '22 at 01:35
-
The `subprocess` module is a built-in module: https://docs.python.org/3/library/subprocess.html. It was added since Python 2.4. It is unlikely that your shell doesn't have it. – Gino Mempin Sep 18 '22 at 02:05
-
But I really don’t have! Umm, maybe I need to update my python, I’ve already 10 years didn’t update – Doggy Sep 25 '22 at 08:00