I tried multiple solutions from this answer 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, even after trying their answers).