Centos 7 pip 安装 MySQL-python报错
-
ERROR: Command errored out with exit status 1: command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-VslONa/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-VslONa/mysql-python/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-pip-egg-info-9mO07P cwd: /tmp/pip-install-VslONa/mysql-python/ Complete output (10 lines): sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-VslONa/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 ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决方法:
先执行命令yum install python-devel mysql-devel
然后再安装
pip install MySQL-python
Collecting MySQL-python Using cached MySQL-python-1.2.5.zip (108 kB) Building wheels for collected packages: MySQL-python Building wheel for MySQL-python (setup.py) ... done Created wheel for MySQL-python: filename=MySQL_python-1.2.5-cp27-cp27m-linux_x86_64.whl size=84800 sha256=61305f58ce59ffa23fc950abea6270106838de0806c460fbfc1608218f83f8b0 Stored in directory: /root/.cache/pip/wheels/55/eb/3b/661bdcd5ca5a576f0331400468db9d5dcbda118fb6c85fd3ee Successfully built MySQL-python Installing collected packages: MySQL-python Successfully installed MySQL-python-1.2.5