您好,登錄后才能下訂單哦!
MacOS Mojave 10.14.4 上安裝 MySQL-python 惡心到吐,以前 MacOS series 版本時安裝過,但沒有這么痛苦。為以后不再被惡心到,還是記錄一下吧。
我們安裝 MySQL-python 之前應該都已經安裝過 mysql 了,這里就不記錄了。
執行 pip install MySQL-python
第一種報錯:
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~
1 error generated.
error: command 'cc' failed with exit status 1
解決方法:
brew install mysql-connector-c
上面的問題解決了,會再報第二種錯:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
解決方法:
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile
echo 'export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib -L/usr/local/opt/openssl@1.1/lib/"' >> ~/.bash_profile
echo 'export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include -I/usr/local/opt/openssl@1.1/include"' >> ~/.bash_profile
echo 'export PKG_CONFIG_PATH="/usr/local/opt/mysql@5.7/lib/pkgconfig"' >> ~/.bash_profile
source ~/.bash_profile
再執行 pip install MySQL-python
OK
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。