Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

erro ao aplicar o comando sudo pip install MySQL-python

Ao aplicar o comando sudo pip install MySQL-python estava me retornando o erro, mostrado abaixo.

Conseguir solucionar o problema instalando : sudo apt-get install libmysqlclient-dev

Collecting MySQL-python
  Downloading MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 112kB 580kB/s 
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    Traceback (most recent call last):

      File "<string>", line 1, in <module>
      File "/tmp/pip-build-tRR44e/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-tRR44e/MySQL-python/setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-tRR44e/MySQL-python/setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
4 respostas
solução!

Sua plataforma é windows? Já tive alunos com problemas na instalação do driver nesta plataforma.

Valeu pela dica!

Eu estava tendo esse erro:

Error loading MySQLdb module: No module named MySQLdb

Solução: sudo apt-get install python-mysqldb

Estou tendo esse erro só que no MacOS. Tem alguma ideia do que seja?


Collecting MySQL-Python
  Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-Python
  Running setup.py bdist_wheel for MySQL-Python ... error
  Complete output from command /Users/Brum/Dropbox/work-dev/alura/python/django_programacao_web_com_python_e_simplicidade/env/django-alura/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-build-kUAWmB/MySQL-Python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/tmpouuvYZpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.6-intel-2.7
  copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-2.7
  creating build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
  creating build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.6-intel-2.7
  /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -fno-omit-frame-pointer -arch x86_64


  Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


  error: command '/usr/bin/clang' failed with exit status 69

  ----------------------------------------
  Failed building wheel for MySQL-Python
  Running setup.py clean for MySQL-Python
Failed to build MySQL-Python
Installing collected packages: MySQL-Python
  Running setup.py install for MySQL-Python ... error
    Complete output from command /Users/Brum/Dropbox/work-dev/alura/python/django_programacao_web_com_python_e_simplicidade/env/django-alura/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-build-kUAWmB/MySQL-Python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-VQJSTK-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Brum/Dropbox/work-dev/alura/python/django_programacao_web_com_python_e_simplicidade/env/django-alura/bin/../include/site/python2.7/MySQL-Python:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-intel-2.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-2.7
    creating build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
    creating build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.6-intel-2.7
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -fno-omit-frame-pointer -arch x86_64


    Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


    error: command '/usr/bin/clang' failed with exit status 69

    ----------------------------------------
Command "/Users/Brum/Dropbox/work-dev/alura/python/django_programacao_web_com_python_e_simplicidade/env/django-alura/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-build-kUAWmB/MySQL-Python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-VQJSTK-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Brum/Dropbox/work-dev/alura/python/django_programacao_web_com_python_e_simplicidade/env/django-alura/bin/../include/site/python2.7/MySQL-Python" failed with error code 1 in /private/var/folders/2m/zgrr7hd15sl4xy2grdq79rth0000gn/T/pip-build-kUAWmB/MySQL-Python/

Boa tarde !

Alguém tem algum material para preparar o ambiente windows do python + mysql ?

Estou usando anaconda para preparação de ambiente.

Aguardo retorno !

Att,

Wander