I have a python 2.7 numpy script which runs in the shell (it is python 2.7.13), but doesn't when run from a terminal or eclipse. Here's the code:
import numpy
def main():
print numpy.__version__
When I run this from the python shell, I get this:
$ python
Python 2.7.13 (default, Sep 5 2017, 08:53:59)
[GCC 7.1.1 20170622 (Red Hat 7.1.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print numpy.__version__
1.12.1
>>>
When I try to execute the command in the terminal, I get this:
$ python simple_example.py
$
The code runs, but there are no import errors.
Can someone please help? This is driving me nuts! My $PYTHONPATH environment variable is below:
$ echo $PYTHONPATH
:/usr/lib/python27.zip:/usr/lib64/python2.7:/usr/lib64/python2.7/plat-
linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-
old:/usr/lib64/python2.7/lib-dynload:/usr/lib64/python2.7/site-
packages:/usr/lib64/python2.7/site-packages/gtk-
2.0:/usr/lib/python2.7/sitepackages:/usr/lib/python27.zip:
/usr/lib64/pytho
n2.7:/usr/lib64/python2.7/p
lat-linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-
old:/usr/lib64/python2.7/lib-dynload:/usr/lib64/python2.7/site-
packages:/usr/lib64/python2.7/site-packages/gtk-
2.0:/usr/lib/python2.7/site-packages