I can’t let life show me. I’ve been searching the Internet all day and all resources seem terribly outdated. From what I can tell, getting MySQLdb and Python to play well together is pretty tricky. I figured it out, and I'm not sure how to move on.
First, I run Python 2.7
The error I get when I try to run "import MySQLdb" in the live interpreter is this:
ImportError: this is MySQLdb version (1, 2, 2, 'final', 0), but _mysql is version (1, 2, 5, 'final', 1)
I also see the following error logs when I run "pip install mysql-python", however I'm not sure thats jsut is due to an incorrect version match. http://pastebin.com/hqVv6aPZ
I have a python project that has a dependency on MySQLdb, and I'm trying to get virtualenv that I am running Python to install the package correctly. This is what I did:
- I created MySQL from the source to make sure that I have a 64-bit compatible version of MySQL on my machine. For this, I used the -universal flag.
- I verified that I am running a 64-bit version of Python.
- MySQL came from Homebrew
- mysql-python came from pip
For life, I cannot understand what to do here. It seems that there is only an incorrect version of the MySQLdb and _mysql versions on my machine. This is true? Should this solution just reinstall the old version of MySQL? It seems that when I force pip to install mysql-python version 1.2.5, it installs MySQLdb version 1.2.2, so I get lost about what to do here because I'm not sure which package from homebrew actually correlates with version 1.2 .5 for _mysql.
EDIT -
sys.path
'/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python27.zip', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/plat-darwin', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/plat-mac', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/Extras/lib/python', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/lib-tk', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/lib-old', '/Users/XXXXXXXXXXX/virtualenvs/qa-automated-tests/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/adam.stark/virtualenvs/qa-automated-tests/lib/python2.7/site-packages'
Python --version says I'm on version 2.7.5. I also installed pastebin for the public. I'm just not sure what exactly is appropriate in this dump, it spits out 16 errors.