Can't install mysql-python (newer versions) in Windows

12,417

I solved it myself.

I use the wheel installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python.

There are two wheel packages there. The amd64 one refuses to install on my platform (Windows) but the other one works just fine. I mean the file with this name:

MySQL_python-1.2.5-cp27-none-win32.whl

Then install it by running this below command in the same folder with the wheel package.

pip install MySQL_python-1.2.5-cp27-none-win32.whl

Python 3.7

Use mysqlclient‑1.3.13‑cp37‑cp37m‑win32.whl

Share:
12,417

Related videos on Youtube

Aminah Nuraini
Author by

Aminah Nuraini

Do you want to contact me? Please click GREEN CONTACT BUTTON in my Upwork profile link below. https://www.upwork.com/fl/aminahnuraini My passion is to build an efficient and best-practice solution in web scraping and automatization, especially using a steady and best-practice framework like Scrapy. Demonstrated problem-solving skills in various challenging websites to scrape, including dynamic websites. Focusing on Scrapy for over 4 years. Familiar with Scrapy's cutting-edge tools like Scrapy Splash, Scrapy Spidermon, Scrapy Crawlera, Scrapy Middlewares, Scrapy Pipelines, and Scrapy Shell. Experienced in managing both small-scale and large-scale projects, even handling over 250 million data using ElasticSearch. As an engineer and architect, I have a proven ability in improving the system's stability and maintainability. I have managed and worked with a geographically dispersed team. Additional significant experience includes database (MySQL, MongoDB, MS SQL), Python 2.x and Python 3.x, Django, XPATH, Regex, Javascript, PHP, Linux, and Networking. If you want to get a VIP consultation with me, you can call me here https://clarity.fm/aminahnuraini Notable Scrapy answer: Split scrapy's large CSV file

Updated on July 01, 2022

Comments

  • Aminah Nuraini
    Aminah Nuraini almost 2 years

    I have mysql-python v1.2.4 installed just fine on my machine (Windows 8). I am using Python 2.7. I always got this below error every time I try to upgrade to v1.2.5. (still happens as of v1.3.7)

    C:\Users\User\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\
    

    9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'fi nal',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6. 0.2\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobuild\temp.wi n32-2.7\Release_mysql.obj /Zl _mysql.c _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory error: command 'C:\Users\User\AppData\Local\Programs\Common\Microsoft \Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

    ----------------------------------------   Rolling back uninstall of mysql-python Command "c:\python27\python.exe -u -c "import
    

    setuptools, tokenize;file='c:\ \users\user\appdata\local\temp\pip-build-utz7of\MySQL-python\setup.py';ex ec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n' ), file, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-osy _cg-record\install-record.txt --single-version-externally-managed --compile" fai led with error code 1 in c:\users\user\appdata\local\temp\pip-build-utz7of\MySQL -python\

    I've tried (and none work):

    1. Installing VS2010
    2. Changing Python Path
    3. Using Wheel module (I got Failed building wheel for MySQL-python)
    4. Installing Python MySQL connector. For both Python and C.
    5. Installing mysqlclient
    6. Installing using Exe installer from https://pypi.python.org/pypi/mysql-python/1.2.5

    Do I miss something? Thanks.

  • Alex R
    Alex R over 5 years
    As of 2018 (now version 1.3.7) this still appears to be the only way to get Python working with MySQL on Windows.
  • Chris Cummings
    Chris Cummings over 4 years
    As of 8/2019 this is the only thing that worked for me. Like OP, the 64bit version should have worked for me but wouldn't. 32bit seems fine so far.
  • Mark
    Mark over 2 years
    One can use some additional flags with PIP to ask for a version of the package where a binary is available e.g. pip install --only-binary :all: mysqlclient. This might not install the current version, but will attempt to install one with a precompiled binary available for your platform. (stackoverflow.com/a/51811349/1880657)