3

Im new to python programming.Im writing a simple command line based twitter app,and i have to use external libraries like simplejson,tweepy etc. Is there a way i can package my python program to include these libraries as well,so that when i distribute this program, the user doesnt have to install the required libraries first himself ?

Thank You

Michael
9,1183 gold badges42 silver badges56 bronze badges
asked Aug 9, 2010 at 18:16

1 Answer 1

4

Python will search for modules in the current directory, so you can just package the libraries along in a subdirectory. For example, if myprogram.py use the foo package:

import foo

this means that there's either

  • a foo.py on your Python path; put it into the same directory as myprogram.py, or
  • a directory foo on your Python path which contains a module __init__.py; put the entire directory (.py files only, no need for .pyc files) into the same directory as myprogram.py.

Of course, have a look at the licenses first to check whether they allow redistribution with your program in this manner.

answered Aug 9, 2010 at 18:21
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.