python2 安装MySQLdb
命令:pip install MySQLdb-python
bug-1: 缺少mysql_config文件
command: /home/archer/Desktop/BitcoinDemo/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-H05y13/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-H05y13/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-gJBrpS
cwd: /tmp/pip-install-H05y13/mysql-python/
Complete output (10 lines):
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-H05y13/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.
解决方式:sudo apt-get install libmysqlclient-dev
bug2-gcc 文件出错
_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/archer/Desktop/BitcoinDemo/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-EeN1Ez/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-EeN1Ez/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-k65hbF/install-record.txt --single-version-externally-managed --compile --install-headers /home/archer/Desktop/BitcoinDemo/venv/include/site/python2.7/MySQL-python Check the logs for full command output.
解决方法:sudo apt-get install python-dev
|