The error message was as follows:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':No such file or directoryerror: command 'C:\\Users\\re\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2----------------------------------------Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\re\\appdata\\local\\temp\\pip-build-xnlpn9\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\re\appdata\local\temp\pip-1k03uu-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\re\appdata\local\temp\pip-build-xnlpn9\mysql-python
I had tried to install the mysql python connector from this website: https://dev.mysql.com/downloads/connector/python/ however this didn't help. I'd found some posts saying that a file in the tar ball used by the pip install needed modifying, however installing the python connector above didn't seem to install any files in the directory as expected, so I wasn't able to update the tar ball to the directory that I needed.
I also tried updating the PATH and PYTHONPATH environmental variables with no luck.
The solution that worked for me eneded up being from this post on stackoverflow: http://stackoverflow.com/a/25445938
I downloaded the file from this website: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
I used the file MySQL_python-1.2.5-cp27-none-win32.whl and installed it using the following command:
pip install C:\MySQL_python-1.2.5-cp27-none-win32.whl
This finally installed successfully, and allowed me to the use the command "import mysql.connector" for my code.
No comments:
Post a Comment