Take the 2-minute tour ×

I am wondering what my options are if I write a Python script that makes use of installed libraries on my computer (like lxml for example) and I want to deploy this script on another computer.

Of course having Python installed on the other machine is a given but do I also have to install all the libraries I use in my script or can I just use the *.pyc file?

Are there any options for making an installer for this kind of problem that copies all the dependencies along with the script in question?

I am talking about Windows machines by the way.


After looking through your answers i thought i should add this:

The thing is....the library required for this to work won't come along quietly with either pip or easy_install on account on it requiring either a windows installer (witch i found after some searching) or being rebuilt on the target computer from sources (witch i'm trying to avoid) .

I thought there was some way to port a pyc file or something to another pc and the interpreter on that station will not require the dependencies on account on it already being translated to bytecode.

If this is not possible, can anyone show me a guide of some sort for making windows package installers ?

share|improve this question
add comment

2 Answers

You should create setup.py for use with setuptools. Dependencies should be included in the field install_requires. Afterwards if you install that package using easy_install or pip, dependencies will be automatically downloaded and installed.

share|improve this answer
add comment

You can also use distutils. A basic setup.py looks as follows:

from distutils.core import setup

    name='My App',
    # ... snip ...
        "somedependency >= 1.2.3"

For differences between distutils and setuptools see this question.

share|improve this answer
add comment

Your Answer


