注:主要针对Ubuntu系统
第一种方法
//打开terminal
sudo python setup.py build
sudo python setup.py install
第二种方法
sudo pip install mysql-python
附上pip安装方法
sudo aptitude install python-setuptools
//没有aptitude可以使用apt-get或者sudo apt-get install aptitude安装
sudo easy_install pip
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "setup.py", line 17, in <module>
metadata, options = get_config()
File "/home/moma/Downloads/MySQL-python-1.2.5/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/home/moma/Downloads/MySQL-python-1.2.5/setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
解决方案
sudo aptitude install libmysqlclient-dev
sudo aptitude install python-dev
sudo aptitude install python-mysqldb
至此,问题应该就解决了,u can enjoy it now ^-^ !
viencoding.com版权所有,允许转载,但转载请注明出处和原文链接: https://viencoding.com/article/68