Search code examples
pythonpostgresqlpackagingpsycopg2

How to package a module with my python script


I just wrote a python script to fix some database issues and it uses the psycopg2 module. For some reason the person that needs to run it (on the server) is claiming that they can't install psycopg2 on their server machine... is there a way that I can package that module within my script such that they don't have to have psycopg2 installed? Something similar to adding a lib folder to the classpath in Java?

Thx in advance, Andre


Solution

  • Make a directory, put your script into it.

    cd into that directory, then run:

    $ easy_install -Z --prefix . psycopg2
    

    That should result in a copy of the python module in the same directory.

    Zip it all up and send the whole thing off.