Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run python production on customer environment

I have some python application that should run on customer site. I compile my py files to pyc (python byte code).

What is the standard way to run the app on the customer environment? The options I see are:

  • As part of my installer, install some python distribution, i.e Anaconda.
  • Require the customer to have python installed in their environment.
  • Bring python libraries and executable along with my code and run it directly from my installation dir.
  • Convert the scripts to exe using some py-to-exe tool.

Application usage: The app is used as a tool to calculate statistics for my main product. The customer won't run it explicitly. It won't have any GUI.

Customer environment will be x64 Windows machine. No other restrictions.

Any recommendations or comments? I couldn't find such discussions on the web.

like image 881
Mugen Avatar asked Sep 05 '16 06:09

Mugen


People also ask

How do you deploy code written in Python for the client's use?

To deploy, you need to upload this artifact to your production machine. To install it, just run dpkg -i my-package. deb . Your virtualenv will be placed at /usr/share/python/ and any script files defined in your setup.py will be available in the accompanying bin directory.

In which environments can you execute Python code?

Python's standard distribution includes IDLE as the default IDE, and you can use it to write, debug, modify, and run your modules and scripts. Other IDEs such as Eclipse-PyDev, PyCharm, Eric, and NetBeans also allow you to run Python scripts from inside the environment.


1 Answers

Given your requirements, the last two options seem most viable:

  • Bring python libraries and executable along with my code and run it directly from my installation dir.
  • Convert the scripts to exe using some py-to-exe tool.

You can either package your code, or freeze your code and create an executable for the target OS.

Given your requirements, I'd suggest the latter. You can go through the Python Packaging Guide for more details regarding packaging.

like image 68
rajat404 Avatar answered Oct 04 '22 19:10

rajat404