Janki Chhatbar
Janki Chhatbar

Reputation: 7

install python-mysqldb using python script

I am writing a python script for an application. The application needs python-mysqldb. In terminal, I can install it with apt-get or pip. How can I install using python script? I am using python 2.7.

Upvotes: 0

Views: 76

Answers (1)

Timo Hanisch
Timo Hanisch

Reputation: 224

You could use pip in a python script for installing the package

import pip

if __name__ == '__main__':
    pip.main(['install', 'MySQL-python'])

Then you can run the script from a terminal.

Upvotes: 1

Related Questions