Path issue related MySQLdb - PyCharm vs Terminal


Just evaluating PyCharm now and are impressed with the setup. A happy user of Intellij since a few years.

I have project that runs on Python and setup with Django.
Had a bit of trouble settings up MySQLdb on my Mac but it seems to work now, at least from some aspects.

If I open up a terminal and run python from there I can import MySQLdb and connect to the database.
If I run python runserver it works fine too, but if I go through PyCharm (run project) it says I got the wrong architecture. How is that possible that everywhere else its fine but not within PyCharm?


Edit: Saw the previous post regarding different Paths for console or PyCharm. Not sure if it´s the same since I havent set any paths manually there related to Python.

Edit 2: When I start the server with sudo python runserver I get that error again. But not when running as other user.

File "/Library/Python/2.7/site-packages/django/db/backends/mysql/", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/myuser/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/, 2): no suitable image found. Did find:
    /Users/myuser/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/ mach-o, but wrong architecture
Comment actions Permalink
Seems relevant indeed! Cheers for answering. Hope they do something about it.


Please sign in to leave a comment.