Command-line option equiv of PYTHONPATH

"Martin v. Löwis" martin at v.loewis.de
Fri Apr 27 01:26:55 EDT 2007


> The '-I<path>' option adds the path to the list of directories that
> contains modules that can be included in a script. I can use it as "#!/
> usr/bin/perl -I<path_to_my_modules>" thereby not asking the user of
> the script to set the <path_to_my_modules> in their environment.
> 
> Is there any equivalent command-line option to the python binary or a
> command-line version of PYTHONPATH?

To rephrase James Stroud's remark: The equivalent to

#/usr/bin/perl -I<path_to_my_modules>
TEXT

is

#/usr/bin/python
import sys
sys.path.append(path_to_my_modules)
TEXT

HTH,
Martin



More information about the Python-list mailing list