您好,登錄后才能下訂單哦!
本文主要給大家簡單講講mac下安裝mysqlclient報錯怎么處理,相關專業術語大家可以上網查查或者找一些相關書籍補充一下,這里就不涉獵了,我們就直奔主題吧,希望mac下安裝mysqlclient報錯怎么處理這篇文章可以給大家帶來一些實際幫助。
命令如下:
$ pip3 install mysqlclient
pip3是因為有兩個python版本,給python3.6對應的pip起了個別名。不然提示找不到。
報錯如下:
Collecting mysqlclient Using cached mysqlclient-1.3.12.tar.gz Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "/private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 26, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/
解決方法:
1、在~/.bash_profile中加入mysql.的路徑
$ cat ~/.bash_profile # 添加/usr/local/mysql/bin set PATH /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin export PATH
2、安裝mysql-connector-c
brew install mysql-connector-c
如果電腦沒有安裝brew,按照以下方式安裝brew,再安裝mysql-connector-c:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3、再次安裝
$ pip3 install mysqlclient
mac下安裝mysqlclient報錯怎么處理就先給大家講到這里,對于其它相關問題大家想要了解的可以持續關注我們的行業資訊。我們的板塊內容每天都會捕捉一些行業新聞及專業知識分享給大家的。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。