Q&A

Q. How can I make a module such as gaussian or stdrandom available to my Python programs?

A. The easiest way is to download gaussian.py from the booksite and put it in the same directory as the client. However, if you do this, you might end up with several copies of gaussian.py in different directories, which makes the code harder to maintain. Instead, you can put gaussian.py in a single directory and configure the PYTHONPATH environment variable to include this directory. The booksite contains instructions for setting the PYTHONPATH variable on your operating system. If you followed the step-by-step instructions on the booksite for installing Python, all of our standard modules (including stdio, stddraw, stdarray, stdrandom, and stdstats ...

Get Introduction to Programming in Python: An Interdisciplinary Approach now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.