"Compiling" Python to run on another machine
<p>I have created a simple-medium complexity script written in Python using Pycharm on my laptop and I wish to run this on my Raspberry Pi using Crontab. All of my past programming experience has been with C++ and C# in Windows and so I would normally just do a build of the project and it all gets compiled and linked into a single executable file.</p>

<p>For Python how do you "compile" the script so that it can be run on another PC? I use some external libraries (requests and ImgurClient) which I had to install using the Pycharm app. I guess I'm correct in thinking that these need to be taken across to the RaspPi too? My script is in two files and so do I need to copy both of these files across? Is there a way to build them into a single file to use easily?</p>

<p>This is my first script which I've written just from my knowledge of other languages and a bit of Googling. Just don't know how to proceed now that I have the actual script.</p>

<p>You can "compile" python files to <code>.pyc</code> but you would still need the python interpreter on the RaspPi to run them.</p>

<p>On a PC that does not have Python, you can create a standalone executable using <code>py2exe</code>, but the executable must then run on Windows.</p>

<p>You have to install a python interpreter on your raspberry Pi, or create an executable with <code>py2exe</code> which targets raspberry Pi (if py2exe exists on that platform), that would be on another raspberry Pi :)</p>

<p>Another alternative would be <code>Cython</code>, but with external libraries as complex as the ones you want to use that would be a really difficult route.</p>

<p><a href="https://www.raspberrypi.org/documentation/usage/python" rel="nofollow">Python on Raspberry Pi</a></p>

<p><a href="http://stackoverflow.com/questions/304883/what-do-i-use-on-linux-to-make-a-python-program-executable">Creating python exes on Linux</a></p>

python cron pycharm