Termos
Termos

Reputation: 694

"Python module not found" error on installed module

I am on Mac 10.6.8 with MAMP server installed. I have installed both Scrapy and MySQLdb module under Python 2.6

When i import MySQLdb module from a python command line or in another project i see no error and it's working as expected. However when i import MySQLdb module in Scrapy project i get import error ("ImportError: No module named MySQLdb").

I am not a Python guru and such behavior is quite unexpected. Why is that happening ? How this can be fixed ?

$ which python
/opt/local/bin/python (which is a symlink to "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6")

$ which scrapy
/usr/local/bin/scrapy

Upvotes: 1

Views: 765

Answers (1)

CaptSolo
CaptSolo

Reputation: 1801

You have multiple Python instances installed (e.g., one is OS X built-in, another from MAMP). Check that those modules are actually installed in MAMP Python 2.6 (see what site-packages directory they reside in).

If you installed a module using easy_install from the built-in Python, you would not be able to use it from other Python instances.

P.S. Why use MAMP at all? Mac OS X already has all the components you need (Apache, MySQL, Python).

Upvotes: 1

Related Questions