Error executing pip install mysql-python


I'm trying to execute the command in windows:

pip install mysql-python

to be able to work with mysql in Django but I get these errors:

  c:\users\fabia\appdata\local\programs\python\python35-32\include\pyconfig.h(243): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2

I can not find the solution, if anyone knows something I would appreciate it, I have python 3.5 and visual studio 2015 with VC ++ compiler.

There is a similar post: Error installing mysql-python but it has not given me solution.

asked by Fabian 19.10.2016 в 06:12

4 answers


Another option is to install Anaconda , which will install a lot of libraries, including the one you want to install.

On the other hand, to use mysql from python, there is a native Python library PySQLdb , which in my experience is Less problematic when installing.

answered by 19.10.2016 / 13:39

Try to download the binary file directly from the following page:


This is a University of California website that provides the binary files for Windows of many Python libraries, especially in the scientific field. Generally it is very up to date (it already has the versions for the new Python 3.6 for example) and before compilation problems or to install Numpy + MKL it is very good.

Follow these steps:

❶ Choose the version for 32 or 64 bit Python 3.5 depending on which one you use.

❷ Once downloaded you go to the directory where it is downloaded and open CMD in that directory.

❸ Finally, you use pip install followed by the full name (including extension) of the downloaded file.

For example, if you are downloaded to the Downloads folder it would be something like that (it's just an example):

C:\User\TuUsuario\Dowloads> python -m pip install mysqlclient-1.3.8-cp35-cp35m-win_amd64.whl

I do not remember if this fork needed any dependency, if it gives you an error due to the lack of a module, just install it with pid before and then run the mysqlclient installation again

answered by 19.10.2016 в 08:45

I recently found a similar problem with a co-worker. You can use:

Easy_install MYSQL-python

It worked for me.

answered by 19.10.2016 в 07:53

You will also need to install the windows SDK that comes with Visual Studio 2015. That's where the file basestd.h is that you need.

answered by 19.10.2016 в 21:45