Tengo escritos algunos programas en Python (uso Python 2.7, pero no tendría problemas para pasarme a Python 3) para analizar una base de datos alojada en MySQL (todo en localhost
, así que no tengo ningún problema para conectarme). Los programas funcionan a la perfección en Debian... sin embargo, necesito también ejecutar estos análisis en una computadora Mac, y me enfrento al problema de que no está disponible el módulo MySQLdb
.
Intenté instalar este módulo con pip
(siguiendo las instrucciones descritas aquí y aquí también) y al ejecutar mi código, me sigo topando con el mensaje "No module named MySQLdb"
.
¿Qué puedo hacer?
Actualización
Aquí está el output de la consola, al intentar usar pip
:
$ sudo pip install MySQL-python
Password:
Downloading/unpacking MySQL-python
Real name of requirement MySQL-python is mysql-python
Downloading MySQL-python-1.2.5.zip (108Kb): 108Kb downloaded
Running setup.py egg_info for package MySQL-python
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/miusuario/build/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/miusuario/build/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/miusuario/.pip/pip.log
Y este es el contenido de pip.log
:
------------------------------------------------------------
/usr/local/bin/pip run on Tue Dec 15 15:54:01 2015
Downloading/unpacking MySQL-python
Getting page http://pypi.python.org/simple/MySQL-python
Could not fetch URL http://pypi.python.org/simple/MySQL-python: HTTP Error 301: Moved Permanently - Redirection to url '/simple$
Will skip URL http://pypi.python.org/simple/MySQL-python when looking for download links for MySQL-python
Getting page http://pypi.python.org/simple/
Real name of requirement MySQL-python is mysql-python
URLs to search for versions for MySQL-python:
* http://pypi.python.org/simple/mysql-python/
Getting page http://pypi.python.org/simple/mysql-python/
Analyzing links from page https://pypi.python.org/simple/mysql-python/
Skipping link https://pypi.python.org/packages/2.4/M/MySQL-python/MySQL_python-1.2.2-py2.4-win32.egg#md5=6620279666cb40e26d89$
Skipping link https://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.2-py2.5-win32.egg#md5=596ec38e498e80ce7375$
Skipping link https://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.3b1-py2.5-linux-i686.egg#md5=43ace300f3eda$
Skipping link https://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.3b2-py2.5-linux-i686.egg#md5=36f78115685d8$
Skipping link https://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.3c1-py2.5-linux-i686.egg#md5=1efcbed6f1f29$
Skipping link https://pypi.python.org/packages/2.6/M/MySQL-python/MySQL_python-1.2.3b1-py2.6-linux-i686.egg#md5=4a640ca00352a$
Skipping link https://pypi.python.org/packages/2.6/M/MySQL-python/MySQL_python-1.2.3b2-py2.6-linux-i686.egg#md5=08ba3e38b899a$
Skipping link https://pypi.python.org/packages/2.6/M/MySQL-python/MySQL_python-1.2.3c1-py2.6-linux-i686.egg#md5=fd472a7c42ef8$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4.win32-py2.7.exe#md5=313b4ceed0144a3019f8$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4b1.win32-py2.7.exe#md5=e0a9f62c7a65eca79a$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4b2.win32-py2.7.exe#md5=ac5812bf27dde82c41$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4b3.win32-py2.7.exe#md5=4596e73263008aa83d$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4b4.win32-py2.7.exe#md5=b53ad22d5a8e16d11f$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4b5.win32-py2.7.exe#md5=ad3dd07e28fd38c89a$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.4c1.win32-py2.7.exe#md5=2a07d427814482fb90$
Skipping link https://pypi.python.org/packages/2.7/M/MySQL-python/MySQL-python-1.2.5.win32-py2.7.exe#md5=6f43f42516ea26e79cfb$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc41542$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3b1.tar.gz#md5=906c00cbfb81f54a474b3e7dcf7$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3b2.tar.gz#md5=e30ae85d490e87f3788eb4a59e5$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3c1.tar.gz#md5=310dd856e439d070b59ece6dd7a$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4.zip#md5=ddf2386daf10a97af115ffad2ed4a9a0$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b1.tar.gz#md5=138669627e06f10c1c2e75122f6$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b2.tar.gz#md5=d13f7351e195277ffd019bd7644$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b3.tar.gz#md5=b495d89426d83ba1e305f774e81$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b3.zip#md5=2fb8db45f5c71dbc5869bd19eaaf54$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b4.tar.gz#md5=0958cb9c23d5a656caac031c488$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b4.zip#md5=2ce6fad5c5fe4074c33e8e799dc7a0$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b5.tar.gz#md5=2d760ee948aff4f50d01afdf8af$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b5.zip#md5=4f645ed23ea0f8848be77f25ffe94a$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4c1.zip#md5=a05925412cd824104da064db6a8896$
Found link https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c$
Using version 1.2.5 (newest of versions: 1.2.5, 1.2.4, 1.2.4c1, 1.2.4b5, 1.2.4b5, 1.2.4b4, 1.2.4b4, 1.2.4b3, 1.2.4b3, 1.2.4b2, $
Downloading from URL https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c$
Running setup.py egg_info for package MySQL-python
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/miusuario/build/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/miusuario/build/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
----------------------------------------
Command python setup.py egg_info failed with error code 1
Exception information:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pip/req.py", line 986, in prepare_files
req_to_install.run_egg_info()
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pip/req.py", line 222, in run_egg_info
command_desc='python setup.py egg_info')
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/pip/__init__.py", line 255, in call_subproc$
% (command_desc, proc.returncode))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1
De aquí deduzco (pero puedo estar equivocado) que hace falta un módulo llamado ConfigParser
... pero al momento de intentar instalarlo, también con pip
, esto es lo que sucede:
$ sudo pip install ConfigParser
Password:
Requirement already satisfied (use --upgrade to upgrade): ConfigParser in /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages
Cleaning up...
Estoy perplejo... el módulo ConfigParser
sí existe, pero al intentar instalar MySQL-python
no lo encuentra
homebrew
?pip
el mismo Python que el que usas para escribir el script?