Python setup.py egg_info mysqlclient

Trying to install mysqlclient using pip3 on Python 3.6.0

$ pip3 install mysqlclient
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/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 54, in get_config
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 54, in <listcomp>
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/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/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/

Already done

brew install mysql-connector-c

But still getting this error

+17
source share
7 answers

This worked for me:

  • brew install mysql-connector-c

  • change mysql_config(find him which mysql_config)

fix this in mysql_config:

# Create options 
libs="-L$pkglibdir"
libs="$libs -l "

This will:

# Create options 
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
  1. brew info openssl
  2. and finally pip3 install mysqlclient
+47
source

I decided to install libmysqlclient-dev first:

sudo apt-get install libmysqlclient-dev

Hope this works for you.

+8
source

, brew install mysql-connector-c .

, , mysql_config ( mysql-connector-c). ( ) mysql-connector-c /Cellar/ /usr/local/bin/ , , Python .

:

  1. brew uninstall mysql-connector-c
  2. / MacOS X MySQL Connector/C Oracle MySQL
    • : .dmg, ...
  3. MacOS Terminal ( iTerm2)
  4. which mysql_config

    • /usr/local/bin/mysql/bin/mysql_config
  5. virtualenv ( )

  6. pip install mysqlclient

Homebrew, , .

, mysqlclient GitHub README.md , C- Python3. , mysql-connector-c ; , , XI Developer CI Tools .

xcode-select --install

C Apple. .

+5

django, mysql. homebrew, - .

MacOS Anaconda, , Anaconda. , mysqlclient conda install mysqlclient

, - .

+2

pymysql mysqlclient. pymysql :

pip install pymysql

URL- SQLAlchemy :

mysql+pymysql://username:passwd@hostname/database

+2

, :

Python3:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip3 install mysqlclient

Python2:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip2 install mysqlclient

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysqlclient

0

Python 2.7 :

  1. -R $ USER/Library/Python/2.7
  2. brew install mysql@5.7
  3. brew install mysql-connector-c
  4. --overwrite mysql@5.7
  5. echo 'export PATH = "/usr/local/opt/mysql@5.7/bin: $ PATH"' >> ~/.bash_profile
  6. sed -i -e 's/libs = "$ libs -l"/libs = "$ libs -l mysqlclient -l ssl -l crypto"/g'/usr/local/bin/mysql_config
  7. pip install MySql-python

, , , Python 2.7 MySql

0

Source: https://habr.com/ru/post/1016940/


All Articles