- 在ubuntu虚拟环境下执行
pip install mysql-python
安装mysql-python时报错:
(blog) parallels@ubuntu:~/Desktop$ pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-Sg0DgT/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 /tmp/pip-build-Sg0DgT/mysql-python/
- 解决方法:
安装libmysqlclient
sudo apt-get install libmysqlclient-dev
找到mysql_config文件的路径
sudo updatedb
locate mysql_config
然后再执行安装mysql即可:
pip install mysql-python
mysql_config的位置为:/usr/bin/mysql_config
网友评论