[Tutor] Q on path information

Alan Gauld alan.gauld at freenet.co.uk
Thu May 25 23:39:21 CEST 2006


> And "whereis python" returns 
> python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4
> /usr/include/python /usr/include/python2.4
> /usr/share/man/man1/python.1.gz
> 
> Does this mean I am using the python executable in
> "/usr/bin/python/" but it then looks for built-in modules in 
> "/usr/lib64/python2.4/"?

I'm no Suse expert but its common in Unix to have a standard 
name for a program which is a link to the latest version.

Thus I guess that /usr/bin/python is a link to whatever 
the current version is, in this case /usr/bin/python2.4.
When you upgrade the installer simply replaces the link 
to point to the new version, so you only have to type 
python to find it.

> (2) A clarification question: PYTHONPATH is not needed as long
> as one just imports built-in modules (such as re or sys) or
> own modules from the same directory as the importing script,
> right? For example, running "python foo.py" on the command
> line, where foo.py imports a module "foo2.py" from the same
> directory, the current directory is inferred automatically, right?

I think sio, it seems to be how windoze does it...
But I usually have PYTHONPATH set up so I can't be quite sure.

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list