日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found

發(fā)布時間:2025/3/19 数据库 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

問題:

運行程序提示: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 found

2、MySQL-python包依賴mysql-devel包,需首先安裝mysql-devel包

yum -y install mysql-devel

3、安裝完成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位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。