"pip freeze" gives different modules from "help('modules')"
Question: I tried multiple solutions from [this
answer](https://stackoverflow.com/questions/739993/how-can-i-get-a-list-of-
locally-installed-python-modules) and they seemed to give be different
results. I am using `virtualenv` and I was wondering if it has something to do
with that. The first method, from the python shell (while the virtual
environment is active):

    
    
    import pip
    installed_packages = pip.get_installed_distributions()
    installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
            for i in installed_packages])
    print(installed_packages_list)
    

This gives the output

    
    
    ['distribute==0.6.34', 'django==1.8.1', 'flup==1.0.3.dev-20110405', 'importlib==1.0.3']
    

The second method, from the bash shell, again while the virtual environment is
active:

    
    
    pip freeze
    

This gives the following list:

    
    
    Warning: cannot find svn location for flup==1.0.3.dev-20110405
    Django==1.8.1
    Ksplice-Uptrack==1.2.12
    MySQL-python==1.2.2
    PIL==1.1.7
    South==0.7.6
    distribute==0.6.34
    django-photologue==2.4
    dnspython==1.11.1
    ethtool==0.6
    ## FIXME: could not find svn URL in dependency_links for this package:
    flup==1.0.3.dev-20110405
    importlib==1.0.3
    iniparse==0.3.1
    iotop==0.3.2
    iwlib==1.0
    mercurial==1.4
    pycurl==7.19.0
    pygpgme==0.1
    pyzor==1.0.0
    urlgrabber==3.9.1
    virtualenv==1.9.1
    yum-metadata-parser==1.1.2
    

Could someone explain why this is happening? Basically, I would like to be
able to import packages from the second list, but I can't (in particular, my
Django server is not able to import MySQLdb, like [this
question](https://stackoverflow.com/questions/2952187/getting-error-loading-
mysqldb-module-no-module-named-mysqldb-have-tried-pre), even after trying
their answers).


Answer: Realized what the problem was...

    
    
    pip -V
    

gave

    
    
    pip 1.3.1 from /home/benjam15/.env/env/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg
            (python 2.6)
    

while I was using python 2.7. Followed [this
post](https://stackoverflow.com/questions/2812520/pip-dealing-with-multiple-
python-versions) since the server's default "pip" command routed to python
2.6, while I really wanted stuff to install for python 2.7.

