With django in python3.6 mac learning environment, according to the official website of the steps, but can not install mysqlclient. Error mysql_config: command not found.
Command is as follows:
$ pip3 install mysqlclient
pip3 is because there are two versions of python, python3.6 corresponding to pip played alias. Otherwise prompted to find.
Given as follows:
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/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/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/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/
Solution:
1, was added in mysql ~ / .bash_profile in. The path
$ cat ~/.bash_profile
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, the installation mysql-connector-cbrew install mysql-connector-c
If the computer is not installed brew, brew installed as follows, and then install the mysql-connector-c:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3, install again$ pip3 install mysqlclient