1. 程式人生 > 其它 >centos7 安裝mysqlclient報錯問題

centos7 安裝mysqlclient報錯問題

centos7 安裝mysqlclient報錯問題

1.安裝 pip3 install mysqlclient 報錯:

ERROR: Command errored out with exit status 1: command: /data/env/pyweb/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"'; file='"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file

);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-noasaa4g/mysqlclient/pip-egg-info cwd: /tmp/pip-install-noasaa4g/mysqlclient/ Complete output (12 lines): /bin/sh: mysql_config: command not found /bin/sh: mariadb_config: command not found /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-noasaa4g/mysqlclient/setup.py", line 16, in <module> metadata, options = get_config() File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 61, in get_config libs = mysql_config("libs") File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

2.分析與解決: 檢視報錯資訊:

mysql_config not found

確定是mysql_config依賴包出現了問題,新增軟連結

ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config 發現還是不行,網上說需要先安裝mysql-devel

yum install mysql-devel

再安裝mysqlclient

pip3 install mysqlclient

解決 ———————————————— 版權宣告:本文為CSDN博主「鄭德帥」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。 原文連結:

https://blog.csdn.net/qq_36853469/article/details/103474533

通過django自制的部落格,歡迎訪問!http://skx.pythonanywhere.com/