0

In Linux, if I type in which python2.7 I get /usr/bin/python2.7. If I type in /usr/bin/python2.7 to bring up the Python2.7 environment, and I type in import pandas as pd it works fine.

Now I'm running a python file on apache2 on the same server with the shebang #!/usr/bin/python2.7 next line I put import pandas as pd and the error log spits out No module named pandas. I don't understand why it doesn't work if it's using the same Python?

Also Here's if I do python2.7 -m site

sys.path = [
    '/home/archie',
    '/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/archie/.local/lib/python2.7/site-packages',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/local/lib/python2.7/dist-packages/requests-2.21.0-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/urllib3-1.24.1-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/chardet-3.0.4-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/certifi-2018.11.29-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/simple_salesforce-0.74.2-py2.7.egg',
    '/usr/lib/python2.7/dist-packages',
]

if I do pip2.7 uninstall pandas I get

Uninstalling pandas-0.23.4:
  Would remove:
    /home/archie/.local/lib/python2.7/site-packages/pandas-0.23.4.dist-info/*
    /home/archie/.local/lib/python2.7/site-packages/pandas/*
Archie
  • 95
  • 6

1 Answers1

0

If you're using a bash-like shell you might also want to try typing type python2.7. It's entirely possible there's an alias, which which is completely unaware of.

woodm1979
  • 1,151
  • 10
  • 8