Problem installing MySQL-Python on Mac OS 10.14.1

最后都变了- 提交于 2019-12-11 06:34:09

问题


I recently upgraded to Mac OS Mojave and now can't install MySQL-Python:

pip install MySQL-Python

...
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.13-x86_64-2.7/_mysql.o -L/usr/local/opt/mysql-client/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

The stack trace says that the "ssl" library wasn't found. I'm not sure what that means though as I have the latest XCode and OpenSSL is installed. Any advice appreciated.


回答1:


I had the same issue on MacOS 10.14, and I was able to solve it using these steps:

Change permissions for /usr/local to allow Homebrew to create links:

sudo chown -R $(whoami) $(brew --prefix)/*

Re-install openssl now that permissions have been fixed:

brew reinstall openssl

Run these two commands to allow compilers to find openssl:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then, try again to install MySQL-Python:

pip install MySQL-Python



回答2:


Change permissions for /usr/local to allow Homebrew to create links:

sudo chown -R $(whoami) $(brew --prefix)/*

Re-install openssl now that permissions have been fixed:

brew reinstall openssl

Run these two commands to allow compilers to find openssl:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then, try again to install MySQL-Python:

pip install MySQL-Python

It works for Mac 10.14.2 with python2.7 /Django 1.9.8 and mysql-server 8 with mysql-clinet;



来源:https://stackoverflow.com/questions/53462886/problem-installing-mysql-python-on-mac-os-10-14-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!