mysqlclient instal错误:“raiseexception”(“错误的mysql配置:可能是https://bugs.mysql.com/bug.php?id"

6rqinv9w  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(294)

我正在尝试将mysqlclient安装到python3.6中。最初我想安装的是mysqldb,但是它说mysqldb不能与python3一起工作(仍然?)。所以我改用mysqlclient。

pip3 install mysqlclient

但是,出现了以下错误:

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 ?

我能知道我该怎么解决这个问题吗?

xtfmy6hx

xtfmy6hx1#

这是2017年11月以来的一个错误。我也犯了同样的错误,这就是原因:
更改 mysql_config mysqlclient python或mysql-connector-c或libmysqlclient中的文件(取决于您使用的内容)
改变


# on macOS, on or about line 112:

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

收件人:


# Create options

    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"

将以下内容添加到 .bash_profile 如何做到这一点:

export PATH="/usr/local/opt/openssl/bin:$PATH"
   export LDFLAGS="-L/usr/local/opt/openssl/lib"
   export CPPFLAGS="-I/usr/local/opt/openssl/include"

pip install mysqlclient ,现在应该可以了。
有关更多信息,请查看此链接的“关于macos上mysql connector/c的bug的说明”部分。

相关问题