Book Image

Mastering Object-oriented Python

By : Steven F. Lott, Steven F. Lott
Book Image

Mastering Object-oriented Python

By: Steven F. Lott, Steven F. Lott

Overview of this book

Table of Contents (26 chapters)
Mastering Object-oriented Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Some Preliminaries
Index

Installing Python modules


We have several techniques to install a Python module or package:

  • We can write setup.py and use the distribution utilities module, distutils, to install the package into Python's lib/site-packages directory. See Distributing Python Modules.

  • We can set the PYTHONPATH environment variable to include our packages and modules. We can set this temporarily in a shell, or we can set it more permanently by editing our ~/.bash_profile or the system's /etc/profile. We'll take a look at this in a little more depth in the later section.

  • We can include the .pth files to add directories to the import path. These files can be located in the local directory or lib/site-packages to provide an indirect reference to a module or package. See the site module documentation in Python Standard Library for more information.

  • The local directory is a package as well. It's always first on the sys.path list. When working on a simple one-module Python application, this is very handy. When working...