Upgraded to OSX 10.11 El Capitan, now cannot use MySQL with Python/Django

北慕城南 提交于 2019-12-12 08:54:15

问题


I have a Python/Django project that I manage using PyCharm. Everything was working perfectly under Mac OSX Yosemite. This morning I upgraded to the final release version of El Capitan, now I cannot run the project. The error I get is:

Error loading MySQLdb module: No module named MySQLdb

I've tried all the suggestions from past questions, but none has resolved it. The most common suggestion seems to be:

sudo pip install MySQL-python

When I do that, I get:

Requirement already satisfied (use --upgrade to upgrade): MySQL-python in /Library/Python/2.7/site-packages

None of the other suggestions help either. I can try reinstalling MySQL, but I don't think it's the MySQL that's broken. This might have something to do with permissions. Can anyone please help get me going again?


回答1:


Happened to me as well. I removed the package, installed mysql using Homebrew and then reinstall the package.

pip uninstall MySQL-python
brew install mysql
pip install MySQL-python

If you run into any issues with brew, be sure to check their troubleshooting page on El Capitan.




回答2:


View this post : MySQL Improperly Configured Reason: unsafe use of relative path

And if you have updated Xcode, open 1 time Xcode for agreement the licence.



来源:https://stackoverflow.com/questions/32878530/upgraded-to-osx-10-11-el-capitan-now-cannot-use-mysql-with-python-django

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