我正在尝试将mysqlclient安装到我的Python 3.6中。我最初想要安装的是MySQLdb,但是有人说MySQLdb无法在Python 3上运行(还是?)。所以我切换到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 ?
我可以知道该怎么做才能解决此问题?
自2017年11月以来,这是一个错误。我遇到了同样的错误,这就是为什么:
mysql_config
更改
# 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 该怎么做:
.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,现在应该可以了。
pip install mysqlclient
有关更多信息,请检查此链接,查看“有关macOS上MySQL Connector / C的错误的说明”部分。