How to install Python package with CMake?

How do you package and deploy a Python application in your own server?

  • What is the best way to manage dependencies. I might have multiple builds each day and they might be using different versions of a same library. Is it a good idea to build a debian package and install in the server? Should I directly run a script which would install the requirements first and then download the python code and run it?

  • Answer:

    Been there, done that. No comments on deb packaging the whole thing. The approach i found out to be good enough so far is to put everything inside a virtualenv http://docs.python-guide.org/en/latest/dev/virtualenvs/ Setup: sudo  apt-get install python-pip python-virtualenv Go to a directory where you want your code to be. Create a virtual environment by 1. virtualenv --distribute <env-name> A directory will be created and you can activate the same via 2. source <env-name>/bin/activate Once this is done pull up code, install all the dependencies using pip until your code works. via pip install <package-name>=<version_no> Once you are done with fire this, it's going to list all the dependencies you have pip freeze It's going to list all the dependencies that you need for your code to run. Place this in a requirements.txt file Next time you want to setup this same again quickly Just follow 1 and 2 and run pip install -r requirements.txt You should be fine with this. Let me know if it requires an edit or is not clear.

Bipul Jain at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.