"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>I don't know if you are gonna be able to run the python script in your other environment, specially if the script uses external libraries (.whl) that you normally install with pip.</p>

<p>A good option to run the script on a clean environment is to use virtualenv:</p>

<p><a href="https://virtualenv.pypa.io/en/stable/" rel="nofollow">https://virtualenv.pypa.io/en/stable/</a></p>

<p>"It creates an environment that has its own installation directories, that doesnât share libraries with other virtualenv environments (and optionally doesnât access the globally installed libraries either)"</p>

<p>And then install only the necessary librarys to run your script. If you export this new environment, you will probably be able to run your script without any problems.</p>

python cron pycharm