python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found
生活随笔
收集整理的這篇文章主要介紹了
python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題:
運行程序提示:ImportError: No module named MySQLdb
解決步驟:
1、安裝MySQL-python包,提示錯誤:EnvironmentError: mysql_config not found
[root@VM static]# pip2 install MySQL-python Looking in indexes: http://mirrors.tencentyun.com/pypi/simple Collecting MySQL-pythonDownloading http://mirrors.tencentyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)100% |████████████████████████████████| 112kB 822kB/s Complete output from command python setup.py egg_info:sh: mysql_config: 未找到命令Traceback (most recent call last):File "<string>", line 1, in <module>File "/tmp/pip-install-p9LTrB/MySQL-python/setup.py", line 17, in <module>metadata, options = get_config()File "setup_posix.py", line 43, in get_configlibs = mysql_config("libs_r")File "setup_posix.py", line 25, in mysql_configraise EnvironmentError("%s not found" % (mysql_config.path,))EnvironmentError: mysql_config not found2、MySQL-python包依賴mysql-devel包,需首先安裝mysql-devel包
yum -y install mysql-devel3、安裝完成mysql-devel包,再次安裝MySQL-python包成功
[root@VM static]# pip2 install MySQL-python Looking in indexes: http://mirrors.tencentyun.com/pypi/simple Collecting MySQL-pythonDownloading http://mirrors.tencentyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)100% |████████████████████████████████| 112kB 890kB/s Installing collected packages: MySQL-pythonRunning setup.py install for MySQL-python ... done Successfully installed MySQL-python-1.2.5?
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql保存中文异常Incorrect
- 下一篇: python快速安装pip