Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
430 views
in Technique[技术] by (71.8m points)

python - MySQLClient instal error: "raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id"

I am trying to install mysqlclient to my Python 3.6. Originally what i want to install is MySQLdb, however it was saying that MySQLdb does not work with Python 3 (still?). So i switch to mysqlclient.

pip3 install mysqlclient

However, it was given this error:

    Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.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/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup.py", line 18, in <module>
        metadata, options = get_config()
      File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 60, in get_config
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 60, in <listcomp>
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 13, in dequote
        raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?")
    Exception: Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?

Can I know what should i do to solve this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's a bug since November 2017. I had the same error and that's what helped:

  1. Make changes to mysql_config file in mysqlclient-python or mysql-connector-c or libmysqlclient (depending on what you are using)

    Change

    # on macOS, on or about line 112:
    # Create options
    libs="-L$pkglibdir"
    libs="$libs -l "

to:

    # Create options
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
  1. Add following to the end of your .bash_profile how to do that:
   export PATH="/usr/local/opt/openssl/bin:$PATH"
   export LDFLAGS="-L/usr/local/opt/openssl/lib"
   export CPPFLAGS="-I/usr/local/opt/openssl/include"
  1. Run pip install mysqlclient, that should work now.

For more info check this link, look at the "Note about bug of MySQL Connector/C on macOS" section.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...