MySQLdb problems in django

。_饼干妹妹 提交于 2019-12-07 10:34:28

I had the same problem and I was able to find the answer here:

http://www.curlybrace.com/words/2011/01/25/mac-os-mysql-python-1-2-3-importerror-library-not-loaded-libmysqlclient-16-dylib/

Basically you need to add this line:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

to your /etc/bashrc file.

Another page that was helpful can be found here:

http://programmingzen.com/2007/12/22/how-to-install-django-with-mysql-on-mac-os-x/

Just the clarify the above answer. Great answer and PowerAnimal is correct. If I could vote him up I would.

Please add the line:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

to:

user/.bash_profile

This is a hidden file. You can view this file by using the following command in terminal.

defaults write com.apple.Finder AppleShowAllFiles YES

then:

killall Finder

When finished:

defaults write com.apple.Finder AppleShowAllFiles NO

then:

killall Finder

To check that Python is communicating with MySQL:

import MySQLdb

MySQLdb.apilevel

To check that Django is working:

import django

print django.VERSION

If no errors, you should be able to continue with your Django setup.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!