通過homebrew安裝。
1
>sudo brew install mysql
2>sudo /usr/local/mysql/support-files/mysql.server start
3>pip install mysql-python
安裝myslq-pyhon時會報錯
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
1 error generated.
error: command 'clang' failed with exit status 1
--------------------------
failed building wheel for mysql-python
這時mac執行以下語句:
1
>brew install mysql-connector
-c
安裝mysql-connector-c時會報錯如下:
error: cannot install mysql-connector-c
because conflicting formulae are installed.
mysql: because both install mysql client libraries
please 『brew unlink mysql『 before continuing.
unlinking removes a formula's symlinks from /usr/local. you can link the formula again after the install finishes. you can --force this install, but the build may fail or cause obscure side-effects in the resulting software.
這時mac執行以下語句:
1
>brew unlink mysql
2>brew install mysql-connector
-c
mysql-connector-c安裝成功!
此時如果執行
1>sudo brew install mysql-python
系統會報錯如下:
traceback (most recent call last):
file "", line 1, in
file "/private/tmp/pip-install-vpfnil/mysql-python/setup.py", line 17, in
metadata, options = get_config()
file "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
file "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
indexerror: string index out of range
這時在mac終端執行
1>
brew
link --overwrite
mysql
建立mysql-connector-c時取消了到mysql的連線,mysql的相關資訊只有在/usr/local/cellar/mysql/8.0.11/bin/mysql_config中才能訪問到。這裡面的檔案不實在任意位置都可以訪問的,所以將mysql重新連線到/usr/local/bin目錄下。
再執行
1>
sudo
pipinstall
mysql-python
系統提示successfully installed mysql-python-1.2.5, mysq-python安裝成功!
文末給大家推薦另乙個小姐姐的部落格,mac安裝mysqldb(python-mysql)模組
Mac安裝Jupyter NoteBook和執行
安裝 pip3 install jupyter啟動 jupyter notebook 指定埠啟動 jupyter notebook port 啟動伺服器但不開啟瀏覽器 jupyter notebook no browser幫助 jupyter notebook help配置檔案路徑 jupyter ...
mac安裝graphviz pycharm執行成功
1.安裝homebrew mac使用者建議直接用homebrew來安裝。當在終端執行 usr bin ruby e curl fssl failed to connect to raw.githubusercontent.com port 443 connection refused試著翻q操作也不...
Mac使用(一)Mac安裝brew
brew homebrew mac osx上的軟體包管理工具,類似linux中yum,能在mac中方便安裝軟體或者解除安裝軟體,brew 的官方 在官方 對brew的用法進行了詳細的描述 安裝方法 在mac中開啟termal 輸入命令 安裝完成 檢視幫助 使用brew查詢軟體 brew search...