Why do I get an import error on this?

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 19:15:59 CEST 2005

"Steve" wrote:

> I'm trying to run a Python program on Unix and I'm encountering some
> behavior I don't understand.  I'm a Unix newbie, and I'm wondering if
> someone can help.

> If I run it through the Python interpreter, this way:
>  >> python test.py
> it runs fine.
> But if I try to run it as an executable script, this way:
>  >> test.py
> I get an import error that says it can't find cx_Oracle.
> Why does it behave differently when I run it in these two ways, and
> what do I need to do to make it run successfully either way?

in the first case, the shell uses the PATH variable to search for a python
interpreter.  in the second case, the shell uses the path specified in the

what does "which python" say?


More information about the Python-list mailing list