MySQLClient安装错误:"raise Exception("错误的MySQL配置:可能是https://bugs.mysql.com/bug.php?id" [英] MySQLClient instal error: "raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id"

查看:73
本文介绍了MySQLClient安装错误:"raise Exception("错误的MySQL配置:可能是https://bugs.mysql.com/bug.php?id"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将mysqlclient安装到我的Python 3.6中.我最初想要安装的是MySQLdb,但是有人说MySQLdb无法在Python 3上运行(还是?).所以我切换到mysqlclient.

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

但是,出现此错误:

    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?

推荐答案

自2017年11月以来,这是一个错误. 我遇到了同样的错误,这就是有帮助的:

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

  1. 对mysqlclient-python或mysql-connector-c或libmysqlclient中的mysql_config文件进行更改(取决于您所使用的内容)

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

更改

    # 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"

  1. .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"

  1. 运行pip install mysqlclient,现在应该可以运行.
  1. Run pip install mysqlclient, that should work now.

有关更多信息,请检查此链接,请参阅有关MySQL Connector/C错误的说明"在macOS上".

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

这篇关于MySQLClient安装错误:"raise Exception("错误的MySQL配置:可能是https://bugs.mysql.com/bug.php?id"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆