@@ -147,8 +147,8 @@ \chapter{Using the Python Interpreter}
147147
148148\section {Invoking the Interpreter }
149149
150- The Python interpreter is usually installed as {\tt /usr/local/python}
151- on those machines where it is available; putting {\tt /usr/local} in
150+ The Python interpreter is usually installed as {\tt /usr/local/bin/ python}
151+ on those machines where it is available; putting {\tt /usr/local/bin } in
152152your {\UNIX } shell's search path makes it possible to start it by
153153typing the command
154154
@@ -159,7 +159,7 @@ \section{Invoking the Interpreter}
159159to the shell. Since the choice of the directory where the interpreter
160160lives is an installation option, other places are possible; check with
161161your local Python guru or system administrator. (E.g., {\tt
162- /usr/local/bin/ python} is a popular alternative location.)
162+ /usr/local/python} is a popular alternative location.)
163163
164164The interpreter operates somewhat like the {\UNIX } shell: when called
165165with standard input connected to a tty device, it reads and executes
@@ -211,7 +211,7 @@ \subsection{Interactive Mode}
211211
212212\bcode \begin {verbatim }
213213python
214- Python 0.9.5 (Jan 2 1992).
214+ Python 0.9.7 (Aug 28 1992).
215215Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam
216216>>>
217217\end {verbatim }\ecode
@@ -248,12 +248,12 @@ \subsection{The Module Search Path}
248248for a file named {\tt foo.py} in the list of directories specified by
249249the environment variable {\tt PYTHONPATH}. It has the same syntax as
250250the {\UNIX } shell variable {\tt PATH}, i.e., a list of colon-separated
251- directory names. When {\tt PYTHONPATH} is not set, an
252- installation-dependent default path is used, usually { \tt
253- .:/usr/local/lib/python}.
251+ directory names. When {\tt PYTHONPATH} is not set, or when the file
252+ is not found there, the search continues in an installation-dependent
253+ default path, usually { \tt .:/usr/local/lib/python}.
254254
255255Actually, modules are searched in the list of directories given by the
256- variable {\tt sys.path} which is initialized from {\tt PYTHONPATH} or
256+ variable {\tt sys.path} which is initialized from {\tt PYTHONPATH} and
257257the installation-dependent default. This allows Python programs that
258258know what they're doing to modify or replace the module search path.
259259See the section on Standard Modules later.
@@ -280,13 +280,35 @@ \subsection{Executable Python scripts}
280280executable, like shell scripts, by putting the line
281281
282282\bcode \begin {verbatim }
283- #! /usr/local/python
283+ #! /usr/local/bin/ python
284284\end {verbatim }\ecode
285285%
286286(assuming that's the name of the interpreter) at the beginning of the
287287script and giving the file an executable mode. The {\tt \# !} must be
288288the first two characters of the file.
289289
290+ \subsection {The Interactive Startup File }
291+
292+ When you use Python interactively, it is frequently handy to have some
293+ standard commands executed every time the interpreter is started. You
294+ can do this by setting an environment variable named {\tt
295+ PYTHONSTARTUP} to the name of a file containing your start-up
296+ commands. This is similar to the {\tt /profile} feature of the UNIX
297+ shells.
298+
299+ This file is only read in interactive sessions, not when Python reads
300+ commands from a script, and not when {\tt /dev/tty} is given as the
301+ explicit source of commands (which otherwise behaves like an
302+ interactive session). It is executed in the same name space where
303+ interactive commands are executed, so that objects that it defines or
304+ imports can be used without qualification in the interactive session.
305+
306+ If you want to read an additional start-up file from the current
307+ directory, you can program this in the global start-up file, e.g.
308+ \verb \execfile('.pythonrc') \. If you want to use the startup file
309+ in a script, you must write this explicitly in the script, e.g.
310+ \verb \import os; \ \verb \execfile(os.environ['PYTHONSTARTUP']) \.
311+
290312\section {Interactive Input Editing and History Substitution }
291313
292314Some versions of the Python interpreter support editing of the current
0 commit comments