日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

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

發布時間:2025/3/19 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 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位技術專家面對面20年技術見證,附贈技術全景圖

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。