First of all, verify that the version of pip is in line with your interpreter.
So for python2.7,
pip --version
should print something like
pip 6.0.8 from /usr/local/lib/python2.7/dist-packages (python 2.7)
depending on how you've installed it. The important part is in the end, where your interpreter ("python 2.7") should be shown.
Once you're sure to have the right pip-version, ensure your package is correctly installed. It should usually be installed in the directory printed out previously by pip (e.g. /usr/local/lib/python2.7/dist-packages/).
Assume you've already done this, what else can go wrong to make your interpreter not finding the 'M2Crypto' package?
python uses the PYTHONPATH
environment variable for module lookups. So, there's the possibility, that your PYTHONPATH
variable has been changed. Try running your program by adding the above-mentioned path to PYTHONPATH
and either exporting it before running your webserver:
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages/:$PYTHONPATH
# run your server here
or by prepending the same variable to your command:
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/:$PYTHONPATH python <run-stuff-here>
This should make your program find the M2Crypto module.