Check if module exists, if not install it

前端 未结 8 1660
北海茫月
北海茫月 2020-12-08 07:41

I want to check if a module exists, if it doesn\'t I want to install it.

How should I do this?

So far I have this code which correctly prints f

8条回答
  •  没有蜡笔的小新
    2020-12-08 08:11

    You can launch pip install %s"%keyring in the except part to do this but I don't recommend it. The correct way is to package your application using distutils so that when it's installed, dependencies will be pulled in.

提交回复
热议问题