我在尝试启动项目时遇到此错误,我认为mysql的体系结构与python版本存在不匹配?但是我不能指出究竟是什么问题,以及如何解决它。
谢谢
ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so: mach-o, but wrong architecture
Process finished with exit code 1
答案 0 :(得分:7)
在PyCharm中,确保指向MySQL的正确路径。如果它在控制台中运行但不在PyCharm中运行;检查环境变量。在顶部导航栏中,在绿色箭头旁边,单击指向下方的箭头/编辑配置,然后在Env变量中添加mysql的路径。就我而言:
DYLD_LIBRARY_PATH ||| /usr/local/mysql/lib/
对于有类似问题的Mac用户,本教程非常棒: http://gpiot.com/mac-os-x-lion-the-perfect-setup-for-python-django/