I recently installed some software, which required python to operate. For some reason, it installed its own version of python, and modified the PYTHONPATH variable. Now, when I attempt to import a module such as numpy, all I get is
ImportError: No module named numpy
echo $PYTHONPATH I get
/home/astrolab/easyaccess/eups/1.2.30/python, which points to the usurping python installation. I get the same result from running
sudo echo $PYTHONPATH. Checking the sys.path setting, I get
['', '/home/astrolab/easyaccess/eups/1.2.30/python', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python27.zip', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7/plat-linux2', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7/lib-tk', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7/lib-old', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7/lib-dynload', '/home/astrolab/.local/lib/python2.7/site-packages', '/home/astrolab/easyaccess/eups/packages/Linux64/python/2.7.6+2/lib/python2.7/site-packages']
however, if I run
sudo python -c "import sys; print sys.path" I get
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/astrolab/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']
which is the correct path, and I can import numpy/matplotlib/etc as I normally would.
My question is: What is the best way of fixing my sys.path/PYTHONPATH environment variable? I thought about editing my .bashrc file and just manually exporting the paths from the sudo'd sys.path, but is that really the best way to fix this? It's also not clear to me if editing my $PYTHONPATH in this way will fix the sys.path difference.
edit: One thing I forgot to include is that I no longer need access to any part of the new python installation. Once I fix this problem I plan on removing the new installation + associated software.