0

Trying to python manage.py syncdb but it gives me an error. Similar to a lot of other questions on here, but the solutions provided do not solve the error after I install them.

My settings.py file inside my project directory

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'network',
        'USER': 'root',
        'PASSWORD': 'mypass',
        'HOST': '', #EMPTY FOR LOCALHOST
        'PORT': '3307', #Empty by default
    }
}

I am using Windows 7, Python 3.4 (I heard was not compatible with install MySQL-python so instead I downloaded mysqlclient 1.3.6).

When I ran easy_install mysql-python it results in

_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe'
failed with exit status 2

Similarly it asks for config-win.h when running pip install mysql-python, along with a scary error

Command "D:\Users\Python\python.EXE -c "import setuptools, tokenize;__file__='C:\\Users\\AppData\\Local\\T
emp\\pip-build-w7q9kjxi\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\AppData\Local\Temp\pip-u982sugf-record\install-record.t
xt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-build
-w7q9kjxi\mysql-python

I'm pretty confused about this. The tutorial I've been looking at strays from me here, and I have no idea what to do with a WHL of mysqlclient.

Things I've tried already:

  • easy_install Distribute works but does not change anything

  • python manage.py syncdb no module named 'MySQLdb'

  • apt-get install python-mysqldb term 'apt-get' not recognized at all.

Please help with this beginner question, thanks for your time, if more info is needed I'd be happy to provide.

4
  • What version of Django? Commented May 23, 2015 at 2:52
  • I think 1.8.1 from recently Commented May 23, 2015 at 2:57
  • You're clearly looking at some out-of-date resources. You almost never want to use easy_install. And you definitely don't want distribute; that's an obsolete project that has been replaced by setuptools. Commented May 23, 2015 at 2:57
  • Anyway, your actual problem smells like the vcvarsall problem configuring Python to use Visual Studio; do a search for [python] vcvarsall and you should find an answer. Commented May 23, 2015 at 2:59

2 Answers 2

3

Without Visual Studio, you'll need a binary installer for the right Python version and architecture. The easiest is probably to get both 32- and 64- bit packages for the installed Python version and install them both.

Sign up to request clarification or add additional context in comments.

8 Comments

This might be a stupid question, but if I have Microsoft Visual Studio 2010 in a different directory can it use that? I'll try the binary hang on.
Yes, as long as the right environment variables are set (methedrine.org/2014/11/19/…) , the Python installer should find the compiler.
I have mysqlclient-1.3.6-cp34-none-win_amd64.whl and now MySQL_python-1.2.5-cp27-none-win_amd64.whl in my Python directory let me rerun pip
It should be either that one or the win32 one, yes.
It has worked PS D:\users\python> pip install mysql-python Requirement already satisfied (use --upgrade to upgrade): mysql-python in d:\users` but for some reason or another python manage.py syncdb` throws a different error about DLL %1 is not a valid Win32 app. Sounds like a question for another day. Thanks!
|
0

I had the same error working on Windows, I solved it by downloading apart and then copying theMySQL_python-1.2.5-py2.7.egg-info and the MySQLdb folders and the _mysql.pyd and _mysql_exceptions.py files in C:\Users\%The-path-of-your-project%\Lib\site-packages

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.