记录在mac上使用MySQL-python产生的问题。
安装
报错,mysql_config没有找到
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| midoksdeMacBook-Pro:ossbc midoks$ sudo -H pip install MySQL-python
Collecting MySQL-python
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 192kB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-yBYBhg/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-yBYBhg/MySQL-python/
|
安装mysql
1
2
3
4
5
6
7
8
9
10
|
再次安装MySQL-python还是报错,发现是编译问题。仔细一看是mysql版本为8.0的。估计还是不支持吧。
卸载mysql(brew uninstall mysql),重新安装。
brew install [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
再次安装MySQL-python没有报错。
同时我也参考下面的链接。
|
参考