AnsweredAssumed Answered

Install python module from within script

Question asked by leftieant76 on Jun 6, 2016
Latest reply on Jul 3, 2016 by leftieant76

I've got a small project that I'm working on that requires installation of the dropbox Python library, as the script needs to a write files to it.

Ideally I'm going to deploy this to a number of users either via a toolbox or a Python add-in.

The catch is that dropbox is not a standard module, and at Python 2.7.5, pip (which I would normally use to install new module) is not a standard module either.

What I'm wondering is:

1/ how would I programatically go about installing a new module from inside a running script; or

2/ is there a way I can bundle the module either into my code, or as part of my code package ('bundle of files') so that the script can find and install the missing module?

3/ I posted a similar question on Reddit and it was suggested that I look at 'freezing' my code (effectively convert to an .exe) - but I'm unsure whether this will allow the script to interact with the toolbox to access parameters etc. Would compiling the code to a .pyc allow this to work?

Any and all help gratefully received!