ya he instalado
Quiero usar MySQL con Django, pero después de instalar el conector mysql intenté instalar mysqlclient para Python en $ pip install mysqlclient
, pero tengo este problema:
Collecting mysqlclient Using cached mysqlclient-1.3.10.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/y_/c31n_1v12v169zfv829p_v_80000gn/T/pip-build-f51KhW/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "setup_posix.py", line 54, in get_config libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')] File "setup_posix.py", line 12, in dequote if s[0] in "\"'" and s[0] == s[-1]: IndexError: string index out of range ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/y_/c31n_1v12v169zfv829p_v_80000gn/T/pip-build-f51KhW/mysqlclient/
Necesitaba lo siguiente para compilar/instalar mysqlclient
brew install mysql-client # mysql-client is not on the `PATH` by default export PATH="/usr/local/opt/mysql-client/bin:$PATH" # openssl is not on the link path by default export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
Entonces podría pip wheel mysqlclient
/ pip install mysqlclient
con éxito
También me he encontrado con este problema, a continuación se muestra mi paso:
1. brew install mysql-connector-c
2. pip install mysqlclient
y luego encontré este error, rastreé el código fuente, pero resolví este y luego ocurrió el otro error.
así que cambié la forma de instalar mysqlclient, solo:
1. brew install mysql
2. pip install mysqlclient
esto funcionó para mí, no ocurrió ningún error.
Instale mysql-client
en lugar de mysql
si no planea tener mysql
en su computadora
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install mysqlclient
exportar LDFLAGS="-L/usr/local/opt/openssl/lib"
exportar CPPFLAGS="-I/usr/local/opt/openssl/include"