Error when installing MySQL-python with pip install in OSX, virtualenv -


first i'm developing django app, when try run server with:

python manage.py runserver 0.0.0.0:8000

the terminal shows:

 "django.core.exceptions.improperlyconfigured: error loading mysqldb module: no module named mysqldb" 

so, need install package:

(app1)me% pip install mysql-python 

errors:

collecting mysql-python   using cached mysql-python-1.2.5.zip building wheels collected packages: mysql-python   running setup.py bdist_wheel mysql-python   complete output command /users/gftecla/documents/shoutout/bin/python -c "import setuptools;__file__='/private/var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-build-zmqoqm/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/tmp1jftpfpip-wheel-:   running bdist_wheel   running build   running build_py   creating build   creating build/lib.macosx-10.5-intel-2.7   copying _mysql_exceptions.py -> build/lib.macosx-10.5-intel-2.7   creating build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/__init__.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/converters.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/connections.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/cursors.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/release.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   copying mysqldb/times.py -> build/lib.macosx-10.5-intel-2.7/mysqldb   creating build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/__init__.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/cr.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/field_type.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/er.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/flag.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/refresh.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   copying mysqldb/constants/client.py -> build/lib.macosx-10.5-intel-2.7/mysqldb/constants   running build_ext   building '_mysql' extension   creating build/temp.macosx-10.5-intel-2.7   gcc -dndebug -g -fwrapv -o3 -wall -wstrict-prototypes -qunused-arguments -qunused-arguments -dversion_info=(1,2,5,'final',1) -d__version__=1.2.5 -i/usr/local/cellar/mysql/5.6.23/include/mysql -i/library/frameworks/python.framework/versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-intel-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing   in file included _mysql.c:44:   /usr/local/cellar/mysql/5.6.23/include/mysql/my_config.h:348:11: warning: 'sizeof_size_t' macro redefined     #define sizeof_size_t  sizeof_long             ^   /library/frameworks/python.framework/versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition here   #        define sizeof_size_t           8                   ^   in file included _mysql.c:44:   /usr/local/cellar/mysql/5.6.23/include/mysql/my_config.h:442:9: warning: 'have_wcscoll' macro redefined   #define have_wcscoll           ^   /library/frameworks/python.framework/versions/2.7/include/python2.7/pyconfig.h:911:9: note: previous definition here   #define have_wcscoll 1           ^   _mysql.c:1589:10: warning: comparison of unsigned expression < 0 false [-wtautological-compare]           if (how < 0 || how >= sizeof(row_converters)) {               ~~~ ^ ~   3 warnings generated.   gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -qunused-arguments -qunused-arguments build/temp.macosx-10.5-intel-2.7/_mysql.o -l/usr/local/cellar/mysql/5.6.23/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.5-intel-2.7/_mysql.so   ld: library not found -lbundle1.o   clang: error: linker command failed exit code 1 (use -v see invocation)   error: command 'gcc' failed exit status 1    ----------------------------------------   failed building wheel mysql-python failed build mysql-python installing collected packages: mysql-python   running setup.py install mysql-python     complete output command /users/gftecla/documents/shoutout/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-build-zmqoqm/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-yoroka-record/install-record.txt --single-version-externally-managed --compile --install-headers /users/gftecla/documents/shoutout/bin/../include/site/python2.7/mysql-python:     running install     running build     running build_py     copying mysqldb/release.py -> build/lib.macosx-10.5-intel-2.7/mysqldb     running build_ext     building '_mysql' extension     gcc -dndebug -g -fwrapv -o3 -wall -wstrict-prototypes -qunused-arguments -qunused-arguments -dversion_info=(1,2,5,'final',1) -d__version__=1.2.5 -i/usr/local/cellar/mysql/5.6.23/include/mysql -i/library/frameworks/python.framework/versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-intel-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing     in file included _mysql.c:44:     /usr/local/cellar/mysql/5.6.23/include/mysql/my_config.h:348:11: warning: 'sizeof_size_t' macro redefined       #define sizeof_size_t  sizeof_long               ^     /library/frameworks/python.framework/versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition here     #        define sizeof_size_t           8                     ^     in file included _mysql.c:44:     /usr/local/cellar/mysql/5.6.23/include/mysql/my_config.h:442:9: warning: 'have_wcscoll' macro redefined     #define have_wcscoll             ^     /library/frameworks/python.framework/versions/2.7/include/python2.7/pyconfig.h:911:9: note: previous definition here     #define have_wcscoll 1             ^     _mysql.c:1589:10: warning: comparison of unsigned expression < 0 false [-wtautological-compare]             if (how < 0 || how >= sizeof(row_converters)) {                 ~~~ ^ ~     3 warnings generated.     gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -qunused-arguments -qunused-arguments build/temp.macosx-10.5-intel-2.7/_mysql.o -l/usr/local/cellar/mysql/5.6.23/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.5-intel-2.7/_mysql.so     ld: library not found -lbundle1.o     clang: error: linker command failed exit code 1 (use -v see invocation)     error: command 'gcc' failed exit status 1      ---------------------------------------- command "/users/gftecla/documents/shoutout/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-build-zmqoqm/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-yoroka-record/install-record.txt --single-version-externally-managed --compile --install-headers /users/gftecla/documents/shoutout/bin/../include/site/python2.7/mysql-python" failed error code 1 in /private/var/folders/9g/1qrws9yj3wn7lghlrpgyh9cc0000gn/t/pip-build-zmqoqm/mysql-python 

i have os x 10.10.2

django 1.8.2

python 2.7

the solution in reinstalling developer tools:

xcode-select --install 

Comments