Centos 6.5安装MySQL-python
報錯信息:
Using cached MySQL-python-1.2.5.zip
???? 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 "/tmp/pip-build-Lil8nB/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-Lil8nB/MySQL-python/
解決方法:(注:這里只是我遇到的問題,摸索到的解決方法,并不表示可以解決所有遇到此類的錯誤!)
[root@sishen ~]#python -m pip install --upgrade --force pip
[root@sishen ~]#pip install setuptools==33.1.1
[root@sishen ~]#yum install -y mysql-dev python-dev libmysqlclient-dev??? (紅色部分,依據(jù)個人情況安裝)
[root@sishen ~]#pip install MySQL-python
測試
[root@sishen ~]# python
Python 2.7.14 (default, Sep 20 2017, 20:34:26)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>>
這就表示已經(jīng)成功安裝MySQL-python。
轉(zhuǎn)載于:https://www.cnblogs.com/zd520pyx1314/p/7790059.html
總結(jié)
以上是生活随笔為你收集整理的Centos 6.5安装MySQL-python的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: React JS 组件间沟通的一些方法
- 下一篇: 搭建Maven私服那点事