python 安装mysqldb

Why can't easy_install find MySQLdb?

第一次安装:

easy_install MySQLdb

失败找不到包名,原因是名称错误

正确的是:

pip install  MySQL-python

然后编译报错:

 Command "/usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-VQ6tqp/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZRqghi-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-VQ6tqp/MySQL-python

原因是mysql-devel开发包没有安装

yum install mysql-devel


你可能感兴趣的:(python,import,failed)