How to run 'python setup.py install' from within Python?

后端 未结 6 1979
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 17:15

I\'m trying to create a generic python script for starting up a python app and I would like to install any dependent python modules if they are missing from the target system.

6条回答
  •  迷失自我
    2021-02-05 18:16

    You can use the subprocess module:

    import subprocess
    subprocess.call(['python', 'setup.py', 'install'])
    

提交回复
热议问题