在macOS Sierra Python 2.7上安装mysqlclient时出错

时间:2017-08-04 10:38:36

标签: python mysql pip

我正在尝试安装mysqlclient:

pip install mysqlclient

我收到此错误:

/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -I/usr/local/opt/lzlib/include -L/usr/local/opt/lzlib/lib -I/usr/local/opt/openssl/include build/temp.macosx-10.6-intel-2.7/_mysql.o -L/usr/local/mariadb/server/lib -lmariadb -lzlib -lpthread -ldl -lm -liconv -lgnutls -lnettle -ltasn1 -lgmp -lhogweed -o build/lib.macosx-10.6-intel-2.7/_mysql.so
ld: library not found for -lzlib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1

我用brew安装了库:

brew install lzlib

但错误仍然存​​在。

也安装了Dev工具:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

1 个答案:

答案 0 :(得分:0)

mysql_config中有一些行如下:

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

应该是:

# Create options 
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"